Check if rule passes
@param mixed $value
@return boolean
505780
private function check($value) {

		$values = ['yes', 'on', '1', 'true'];
		
		if(true === is_string($value)) {
			return true === in_array($value, $values);
		}

		return false;
	}
710656
protected function validate_ruletype($value) {
        if ($value === null) {
            return true;
        }

        if (!class_exists($value) || !is_subclass_of($value, 'core_competency\\competency_rule')) {
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }
183740
public function validate($value)
    {
        // generic pattern match if it's numeric [float/int/double]
        if (!preg_match('/^\d{0,}[.,]?\d*$/', (string)$value)) return false;

        $this->value = $value;

        return true;
    }
827935
private function validateItem($value, $rules)
    {
        if (!$value && strlen($value) == 0 && empty($rules['required'])) {
            return true;
        }

        //
        unset($rules['message'], $rules['trigger']);

        foreach ($rules as $ruleName => $ruleValue) {
            if (!call_user_func("static::{$ruleName}", $value, $ruleValue)) {
                return false;
            }
        }
    }
1237522
protected function validate_ruleconfig($value) {
        $rule = $this->get_rule_object();

        // We don't have a rule.
        if (empty($rule)) {
            if ($value === null) {
                // No config, perfect.
                return true;
            }
            // Config but no rules, whoops!
            return new lang_string('invaliddata', 'error');
        }

        $valid = $rule->validate_config($value);
        if ($valid !== true) {
            // Whoops!
            return new lang_string('invaliddata', 'error');
        }

        return true;
    }
280197
public static function isTraversable($value): bool
    {
        if (is_array($value)) {
            return true;
        }

        if (is_object($value) && ($value instanceof Traversable)) {
            return true;
        }

        return false;
    }
468889
static public function isToday($value)
    {
        $time = DataHelper::toUnixtime($value);
        $todayRange = static::todayRange();
        
        if ($time >= $todayRange[0] && $time <= $todayRange[1]) {
            return true;
        }
        return false;
    }
150889
public function Check($value)
    {
        if ($this->trimValue)
            $value = trim($value);
        $result = array();
        if (!preg_match($this->pattern, $value))
            $this->error = self::NoMatch;
        
        return $this->error == '';
    }
1321219
public static function isValid($value)
    {
        if($value === null){
            return false;
        }

        $reflection = new \ReflectionClass(get_called_class());
        return in_array($value, $reflection->getConstants());
    }
804602
public function canParse($value)
    {
        if (is_string($value) && preg_match(self::REGEX, $value)) {
            return true;
        }

        return false;
    }
312144
protected function shouldMinify($value)
    {
        if ($this->force) {
            return true;
        }

        return !$this->containsBadHtml($value) && !$this->containsBadComments($value);
    }
132040
protected function isValueTypeValidForExactConditions($value)
    {
        if (is_string($value) || is_bool($value) || is_int($value) || is_float($value)) {
            return true;
        }

        return false;
    }
291925
public function isValid($value)
    {
        if (!filter_var($value, $this->getFilter(), $this->getOption())) {
            $this->_error($this->getMessageKey(), $value);
            return false;
        }

        return true;
    }
832448
public function isValid($value)
    {
        if (!preg_match('/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/', $value)) {
            return $this->_error(self::INVALID);
        }
        foreach (explode('.', $value) as $num) {
            if ($num > 255 || $num < 0) {
                return false;
            }
        }
        return true;
    }
698653
protected function belowMinBorder($value): bool
    {
        if (null === $this->minDate) {
            return false;
        }

        return $this->minDate->isAfter(Date::castFrom($value, 'value'));
    }
851213
public function isValid($value)
    {
        $result = preg_match('/(.+)/i', $value);
        if (!$result) {
            $this->addMessage('notEmpty');
        }
        return (boolean) $result;
    }
505755
protected function belowMinBorder($value): bool
    {
        if (null === $this->minDate) {
            return false;
        }

        if (!($value instanceof Datespan)) {
            throw new \LogicException('Given value must be of instance ' . Datespan::class);
        }

        return $value->startsBefore($this->minDate->change()->timeTo('00:00:00'));
    }