Check if rule passes
@return boolean
482650
public function isValid() {
		
		$params = $this -> getParameters();
		$file 	= $this -> getFile();
		$info 	= (object) pathinfo($file['name']);
		$params = array_map(function($value) {

			if(false === is_string($value)) {
				return trigger_error(sprintf('Extension passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($value)), E_USER_ERROR);
			}

			return ltrim(strtolower($value), '.');
		}, $params);

		if(true === isset($info -> extension) && false === in_array($info -> extension, $params)) {
			return true;
		}

		return false;
	}
834829
public function hasRuleBySelector( $selector ){
		foreach( $this->rules as $rule )
			if( $selector == $rule->getSelector() )
				return TRUE;
		return FALSE;
	}
582295
public function getDefaultNextRule () {
		return isset($this->rule->next[$this->nextName][1]) ? $this->rule->next[$this->nextName][1] : (($this->getDefaultNextUrl() === null) ? static::NEXT_RENDERING : static::NEXT_FORWARD);
	}
849124
protected function isNested($rule)
    {
        if (isset($rule->rules) && is_array($rule->rules) && count($rule->rules) > 0) {
            return true;
        }

        return false;
    }
211462
public static function matchDetectionRulesAgainstUA(){
		$userAgent=isset(self::$httpHeaders['HTTP_USER_AGENT'])?self::$httpHeaders['HTTP_USER_AGENT']:'';
		if(empty($userAgent))
			return false;

		//foreach(self::getRules() as $_regex){
		foreach(self::getMobileDetectionRules() as $_regex){
			if(empty($_regex)) continue;
			if(self::match($_regex,$userAgent))
				return true;
			}
		return false;
		}
1261687
public function isSuccessful()
    {
        $decisionOk = Gateway::DECISION_ACCEPTED === (string) $this->data->decision;
        $codeOk = Gateway::CODE_OK === (string) $this->data->code;

        return $decisionOk && $codeOk;
    }
502465
boolean containsRule( Rule rule ) {
        for( int i = state.stackIdx - 1; i >= 0; i-- ) {
            if( rule == state.stack.get( i ).mixin ) {
                return true;
            }
        }
        return false;
    }
393730
public function passes()
    {
        $validator = $this->validator->make($this->data, $this->rules, $this->messages);

        if( $validator->fails() )
        {
            $this->errors = $validator->messages();
            return false;
        }

        return true;
    }
679424
protected function checkRuleCorrect($rule)
    {
        if (!isset($rule->value)) {
            // We will assume a missing value for the rule is to be interpreted as empty.
            $rule->value = null;
        }
        if (!isset($rule->id, $rule->field, $rule->type, $rule->input, $rule->operator)) {
            return false;
        }
        if (!isset($this->operators[$rule->operator])) {
            return false;
        }

        return true;
    }
461181
public function check($value) : bool
    {
        try {
            if (false == \DateTime::createFromFormat($this->rule, $value)) {
                return false;
            }
            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
1090901
public function isValid()
    {
        $this->errors = array();

        foreach ($this->rules() as $rule) {
            $fields = array_map('trim', explode(',', $rule[0]));
            $ruleName = $rule[1];
            $params = array_slice($rule, 2);

            // check scenario
            if (!empty($rule['on'])) {
                $onScenarios = explode(',', $rule['on']);
                if (!in_array($this->getScenario(), $onScenarios)) {
                    continue;
                }
            }

            if (!empty($rule['except'])) {
                $exceptScenarios = explode(',', $rule['except']);
                if (in_array($this->getScenario(), $exceptScenarios)) {
                    continue;
                }
            }

            if (method_exists($this, $ruleName)) {
                // method
                foreach ($fields as $field) {
                    $this->{$ruleName}($field, $params);
                }
            } else {
                // validator class
                $validatorClassName = $this->getValidatorClassNameByRuleName($ruleName);

                /* @var $validator \Sokil\Mongo\Validator */
                $validator = new $validatorClassName;
                if (!$validator instanceof Validator) {
                    throw new Exception('Validator class must implement \Sokil\Mongo\Validator class');
                }

                $validator->validate($this, $fields, $params);
            }
        }

        return !$this->hasErrors();
    }
322928
public function getRule(): ?Rule
    {
        $layoutView = $this->getLayoutView();
        if (!$layoutView instanceof LayoutViewInterface) {
            return null;
        }

        return $layoutView->getParameter('rule');
    }
152158
protected function hasRule(array $keyRules, $ruleNames)
    {

        $ruleNames = (array)$ruleNames;

        foreach ($keyRules as $ruleName=>$parameters) {
            if (in_array($ruleName, $ruleNames)) {
                return true;
            }
        }

        return false;
    }
323456
private function unfold(): bool
    {
        while (0 < \count($this->todo)) {
            $rule = \array_pop($this->todo);

            if ($rule instanceof Escape) {
                $this->addTrace($rule);
            } else {
                $out = $this->reduce($this->grammar->fetch($rule->getRule()), $rule->getData());

                if ($out === false && $this->backtrack() === false) {
                    return false;
                }
            }
        }

        return true;
    }
565565
private function validateRule($rule)
    {
        if (strpos($rule, '/')) {
            list($rule, $mask) = explode('/', $rule);
        }

        if (filter_var($rule, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            if (isset($mask) && ($mask < 1 || $mask > 30)) {
                return false;
            }

            return true;
        } elseif (filter_var($rule, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
            if (isset($mask) && ($mask < 1 || $mask > 128)) {
                return false;
            }

            return true;
        }

        return false;
    }
757086
public function validate() {
        // Deny if rules array is empty
        if (empty($this->rules))
            return true;
        // If rules are invalid
        if (!is_array($this->rules))
            throw new \Exception("The rules must be an array of the validator|sanitize rules", 1);
        // Loop the rules
        foreach ($this->rules as $rule) {
            // Run rule
            $rule instanceof \Closure
                ? $rule($this)
                : call_user_func($rule, $this);
        }
        // Check the field is valid
        return !$this->hasError();
    }
79235
public function pass()
    {
        $action      = $this->getParameter('action');

        return $this->Permissions->checkPermission($action, $this->getLocal('SiteSlug'));
    }