src/Validator.php
static function addRule(\CharlotteDunois\Validation\RuleInterface $rule) {
        if(static::$rulesets === null) {
            static::initRules();
        }
        
        $class = \get_class($rule);
        $arrname = \explode('\\', $class);
        $name = \array_pop($arrname);
        
        $rname = \str_replace('rule', '', \strtolower($name));
        static::$rulesets[$rname] = $rule;
        
        if(\stripos($name, 'rule') !== false) {
            static::$typeRules[] = $rname;
        }
    }
static function addRule(\CharlotteDunois\Validation\RuleInterface $rule) {
        if(static::$rulesets === null) {
            static::initRules();
        }
        
        $class = \get_class($rule);
        $arrname = \explode('\\', $class);
        $name = \array_pop($arrname);
        
        $rname = \str_replace('rule', '', \strtolower($name));
        static::$rulesets[$rname] = $rule;
        
        if(\stripos($name, 'rule') !== false) {
            static::$typeRules[] = $rname;
        }
    }
static function addRule ( \ CharlotteDunois \ Validation \ RuleInterface $ rule ) { if ( static :: $ rulesets === null ) { static :: initRules ( ) ; } $ class = \ get_class ( $ rule ) ; $ arrname = \ explode ( '\\' , $ class ) ; $ name = \ array_pop ( $ arrname ) ; $ rname = \ str_replace ( 'rule' , '' , \ strtolower ( $ name ) ) ; static :: $ rulesets [ $ rname ] = $ rule ; if ( \ stripos ( $ name , 'rule' ) !== false ) { static :: $ typeRules [ ] = $ rname ; } }
Adds a new rule.
@param \CharlotteDunois\Validation\RuleInterface  $rule
@return void
@throws \InvalidArgumentException
Adds a new rule .