public function addField($field, $title, array $rules = array()) {
        $this->_fields[$field] = $title;

        /**
         * 0 => rule
         * rule => [opt, ...]
         */
        if ($rules) {
            foreach ($rules as $rule => $options) {
                if (is_numeric($rule)) {
                    $rule = $options;
                    $options = array();
                }

                $this->addRule($field, $rule, null, $options);
            }
        }

        return $this;
    }
public function addField($field, $title, array $rules = array()) {
        $this->_fields[$field] = $title;

        /**
         * 0 => rule
         * rule => [opt, ...]
         */
        if ($rules) {
            foreach ($rules as $rule => $options) {
                if (is_numeric($rule)) {
                    $rule = $options;
                    $options = array();
                }

                $this->addRule($field, $rule, null, $options);
            }
        }

        return $this;
    }
public function addField ( $ field , $ title , array $ rules = array ( ) ) { $ this -> _fields [ $ field ] = $ title ; /**
         * 0 => rule
         * rule => [opt, ...]
         */ if ( $ rules ) { foreach ( $ rules as $ rule => $ options ) { if ( is_numeric ( $ rule ) ) { $ rule = $ options ; $ options = array ( ) ; } $ this -> addRule ( $ field , $ rule , null , $ options ) ; } } return $ this ; }
Add a field to be used in validation. Can optionally apply an array of validation rules.

@param string $field
@param string $title
@param array $rules
@return $this
Add a field to be used in validation . Can optionally apply an array of validation rules .