validator::__call PHP Method

__call() public method

public __call ( $method, $params )
    public function __call($method, $params)
    {
        if (is_null($this->key)) {
            return $this;
        }
        if (strpos($method, 'is_') === 0) {
            $method = substr($method, 3);
            $reverse = false;
        } elseif (strpos($method, 'not_') === 0) {
            $method = substr($method, 4);
            $reverse = true;
        }
        if (isset($this->methods[$method]) === false) {
            throw new ErrorException('Validator method ' . $method . ' not found');
        }
        $validator = $this->methods[$method];
        $message = array_pop($params);
        $result = (bool) call_user_func_array($validator, array_merge(array($this->value), $params));
        $result = (bool) ($result ^ $reverse);
        if ($result === false) {
            $this->errors[$this->key][] = $message;
        }
        return $this;
    }