private function validateByRule( $field, $value, $rule, $message = null )
    {
        $ruleClassName = $this->ruleToClassName($this->getRuleName($rule));

        if (!class_exists($ruleClassName)) {
            return false;
        }

        $ruleObject = new $ruleClassName();
        if ($this->isLengthRule($rule)) {
            $ruleObject->setLength($this->extractLength($rule));;
        } else {
            if ($this->isSameRule($rule)) {
                $ruleObject->prepareRule($this->fields, $this->extractSame($rule));
            }
        }
        $result = $ruleObject->run($this->keyToLabel($field), $value, $message);

        if (!$result) {
            static::$errors[ $field ] = $ruleObject->message();
        }

        return $result;
    }
private function validateByRule( $field, $value, $rule, $message = null )
    {
        $ruleClassName = $this->ruleToClassName($this->getRuleName($rule));

        if (!class_exists($ruleClassName)) {
            return false;
        }

        $ruleObject = new $ruleClassName();
        if ($this->isLengthRule($rule)) {
            $ruleObject->setLength($this->extractLength($rule));;
        } else {
            if ($this->isSameRule($rule)) {
                $ruleObject->prepareRule($this->fields, $this->extractSame($rule));
            }
        }
        $result = $ruleObject->run($this->keyToLabel($field), $value, $message);

        if (!$result) {
            static::$errors[ $field ] = $ruleObject->message();
        }

        return $result;
    }
private function validateByRule ( $ field , $ value , $ rule , $ message = null ) { $ ruleClassName = $ this -> ruleToClassName ( $ this -> getRuleName ( $ rule ) ) ; if ( ! class_exists ( $ ruleClassName ) ) { return false ; } $ ruleObject = new $ ruleClassName ( ) ; if ( $ this -> isLengthRule ( $ rule ) ) { $ ruleObject -> setLength ( $ this -> extractLength ( $ rule ) ) ; ; } else { if ( $ this -> isSameRule ( $ rule ) ) { $ ruleObject -> prepareRule ( $ this -> fields , $ this -> extractSame ( $ rule ) ) ; } } $ result = $ ruleObject -> run ( $ this -> keyToLabel ( $ field ) , $ value , $ message ) ; if ( ! $ result ) { static :: $ errors [ $ field ] = $ ruleObject -> message ( ) ; } return $ result ; }
Validate a Rule against built-in rules

@param $field
@param $value
@param $rule
@param null $message
@return mixed
Validate a Rule against built - in rules