public function validate($input)
    {
        $this->errors = [];

        foreach($this->rawRules as $rules){

            list($ruleName, $rule) = $rules;

            // notOf or oneOf
            if ($rule instanceof Validate) {
                $rule->validate($input);
                $this->errors = array_merge($this->errors, $rule->getErrors());
                continue;
            }

            if ($rule instanceof When) {
                $rule->invert = $this->invert;
                $rule->validate($input);
                $this->errors = array_merge($this->errors, $rule->getErrors());
                continue;
            }

            if ($rule instanceof Attributes) {
                $config = [
                    'one' => $this->one,
                    'invert' => $this->invert,
                    'remainder' =>  $this->remainder
                ];
                Instance::configure($rule, $config);
                $rule->validate($input);
                $this->errors = $rule->getErrors();
                break;
            }

            if ($this->skipEmpty && $rule->skipEmpty && $this->isEmpty($input, $rule)) {
                continue;
            }

            if ($rule->validate($input) === !$this->invert) {
                continue;
            }
            $this->errors[$ruleName] = $this->error($ruleName, $rule);
            if ($this->one === true) {
                break;
            }
        }
        return empty($this->errors);
    }
public function validate($input)
    {
        $this->errors = [];

        foreach($this->rawRules as $rules){

            list($ruleName, $rule) = $rules;

            // notOf or oneOf
            if ($rule instanceof Validate) {
                $rule->validate($input);
                $this->errors = array_merge($this->errors, $rule->getErrors());
                continue;
            }

            if ($rule instanceof When) {
                $rule->invert = $this->invert;
                $rule->validate($input);
                $this->errors = array_merge($this->errors, $rule->getErrors());
                continue;
            }

            if ($rule instanceof Attributes) {
                $config = [
                    'one' => $this->one,
                    'invert' => $this->invert,
                    'remainder' =>  $this->remainder
                ];
                Instance::configure($rule, $config);
                $rule->validate($input);
                $this->errors = $rule->getErrors();
                break;
            }

            if ($this->skipEmpty && $rule->skipEmpty && $this->isEmpty($input, $rule)) {
                continue;
            }

            if ($rule->validate($input) === !$this->invert) {
                continue;
            }
            $this->errors[$ruleName] = $this->error($ruleName, $rule);
            if ($this->one === true) {
                break;
            }
        }
        return empty($this->errors);
    }
public function validate ( $ input ) { $ this -> errors = [ ] ; foreach ( $ this -> rawRules as $ rules ) { list ( $ ruleName , $ rule ) = $ rules ; // notOf or oneOf if ( $ rule instanceof Validate ) { $ rule -> validate ( $ input ) ; $ this -> errors = array_merge ( $ this -> errors , $ rule -> getErrors ( ) ) ; continue ; } if ( $ rule instanceof When ) { $ rule -> invert = $ this -> invert ; $ rule -> validate ( $ input ) ; $ this -> errors = array_merge ( $ this -> errors , $ rule -> getErrors ( ) ) ; continue ; } if ( $ rule instanceof Attributes ) { $ config = [ 'one' => $ this -> one , 'invert' => $ this -> invert , 'remainder' => $ this -> remainder ] ; Instance :: configure ( $ rule , $ config ) ; $ rule -> validate ( $ input ) ; $ this -> errors = $ rule -> getErrors ( ) ; break ; } if ( $ this -> skipEmpty && $ rule -> skipEmpty && $ this -> isEmpty ( $ input , $ rule ) ) { continue ; } if ( $ rule -> validate ( $ input ) === ! $ this -> invert ) { continue ; } $ this -> errors [ $ ruleName ] = $ this -> error ( $ ruleName , $ rule ) ; if ( $ this -> one === true ) { break ; } } return empty ( $ this -> errors ) ; }
Checks a value.
@param mixed $input
@return bool
@throws ValidateException
Checks a value .