src/Violin.php
protected function getRuleToCall($rule)
    {
        if (isset($this->customRules[$rule])) {
            return $this->customRules[$rule];
        }

        if (method_exists($this, 'validate_' . $rule)) {
            return [$this, 'validate_' . $rule];
        }

        if (isset($this->usedRules[$rule])) {
            return [$this->usedRules[$rule], 'run'];
        }

        $ruleClass = 'Violin\\Rules\\' . ucfirst($rule) . 'Rule';
        $ruleObject = new $ruleClass();

        $this->usedRules[$rule] = $ruleObject;

        return [$ruleObject, 'run'];
    }
protected function getRuleToCall($rule)
    {
        if (isset($this->customRules[$rule])) {
            return $this->customRules[$rule];
        }

        if (method_exists($this, 'validate_' . $rule)) {
            return [$this, 'validate_' . $rule];
        }

        if (isset($this->usedRules[$rule])) {
            return [$this->usedRules[$rule], 'run'];
        }

        $ruleClass = 'Violin\\Rules\\' . ucfirst($rule) . 'Rule';
        $ruleObject = new $ruleClass();

        $this->usedRules[$rule] = $ruleObject;

        return [$ruleObject, 'run'];
    }
protected function getRuleToCall ( $ rule ) { if ( isset ( $ this -> customRules [ $ rule ] ) ) { return $ this -> customRules [ $ rule ] ; } if ( method_exists ( $ this , 'validate_' . $ rule ) ) { return [ $ this , 'validate_' . $ rule ] ; } if ( isset ( $ this -> usedRules [ $ rule ] ) ) { return [ $ this -> usedRules [ $ rule ] , 'run' ] ; } $ ruleClass = 'Violin\\Rules\\' . ucfirst ( $ rule ) . 'Rule' ; $ ruleObject = new $ ruleClass ( ) ; $ this -> usedRules [ $ rule ] = $ ruleObject ; return [ $ ruleObject , 'run' ] ; }
Gets and instantiates a rule object, e.g. IntRule. If it has
already been used, it pulls from the stored rule objects.

@param  string $rule

@return mixed
Gets and instantiates a rule object e . g . IntRule . If it has already been used it pulls from the stored rule objects .