src/Framework/Form/Element/AbstractElement.php
public function addValidator($validator)
    {
        if (!($validator instanceof \Pop\Validator\AbstractValidator) && !is_callable($validator)) {
            throw new Exception('Error: The validator must be an instance of Pop\Validator\AbstractValidator or a callable object.');
        }
        $this->validators[] = $validator;
        return $this;
    }
public function addValidator($validator)
    {
        if (!($validator instanceof \Pop\Validator\AbstractValidator) && !is_callable($validator)) {
            throw new Exception('Error: The validator must be an instance of Pop\Validator\AbstractValidator or a callable object.');
        }
        $this->validators[] = $validator;
        return $this;
    }
public function addValidator ( $ validator ) { if ( ! ( $ validator instanceof \ Pop \ Validator \ AbstractValidator ) && ! is_callable ( $ validator ) ) { throw new Exception ( 'Error: The validator must be an instance of Pop\Validator\AbstractValidator or a callable object.' ) ; } $ this -> validators [ ] = $ validator ; return $ this ; }
Add a validator the form element

@param  mixed $validator
@throws Exception
@return AbstractElement
Add a validator the form element