function validate($ruleName, $values, $options = null, $multiple = false)
    {
        $rule =& $this->getRule($ruleName);

        if (is_array($values) && !$multiple) {
            $result = 0;
            foreach ($values as $value) {
                if ($rule->validate($value, $options) === true) {
                    $result++;
                }
            }
            return ($result == 0) ? false : $result;
        } else {
            return $rule->validate($values, $options);
        }
    }
function validate($ruleName, $values, $options = null, $multiple = false)
    {
        $rule =& $this->getRule($ruleName);

        if (is_array($values) && !$multiple) {
            $result = 0;
            foreach ($values as $value) {
                if ($rule->validate($value, $options) === true) {
                    $result++;
                }
            }
            return ($result == 0) ? false : $result;
        } else {
            return $rule->validate($values, $options);
        }
    }
function validate ( $ ruleName , $ values , $ options = null , $ multiple = false ) { $ rule = & $ this -> getRule ( $ ruleName ) ; if ( is_array ( $ values ) && ! $ multiple ) { $ result = 0 ; foreach ( $ values as $ value ) { if ( $ rule -> validate ( $ value , $ options ) === true ) { $ result ++ ; } } return ( $ result == 0 ) ? false : $ result ; } else { return $ rule -> validate ( $ values , $ options ) ; } }
Performs validation on the given values

@param     string   $ruleName        Name of the rule to be used
@param     mixed    $values          Can be a scalar or an array of values
to be validated
@param     mixed    $options         Options used by the rule
@param     mixed    $multiple        Whether to validate an array of values altogether
@access    public
@return    mixed    true if no error found, int of valid values (when an array of values is given) or false if error
Performs validation on the given values