Bluz\Validator\Validator::validate PHP Method

validate() public method

Validate chain of rules
public validate ( mixed $input, boolean $all = false ) : boolean
$input mixed
$all boolean
return boolean
    public function validate($input, $all = false) : bool
    {
        $this->input = $input;
        $this->invalid = [];
        // clean
        foreach ($this->rules as $rule) {
            if (!$rule->validate($this->input)) {
                $this->invalid[] = $rule;
                if (!$all) {
                    break;
                }
            }
        }
        return sizeof($this->invalid) ? false : true;
    }