protected function _processRules($field, ValidationSet $rules, $data, $newRecord)
    {
        $errors = [];
        // Loading default provider in case there is none
        $this->getProvider('default');

        foreach ($rules as $name => $rule) {
            $result = $rule->process($data[$field], $this->_providers, compact('newRecord', 'data', 'field'));
            if ($result === true) {
                continue;
            }

            if (is_array($result) && $name === static::NESTED) {
                $errors = $result;
            } elseif (is_string($result)) {
                $errors[$name] = $result;
            } else {
                $args = $rule->get('pass');
                $errors[$name] = __d($this->_validationDomain, $name, $this->_translateArgs($args));
            }

            if ($rule->isLast()) {
                break;
            }
        }

        return $errors;
    }
protected function _processRules($field, ValidationSet $rules, $data, $newRecord)
    {
        $errors = [];
        // Loading default provider in case there is none
        $this->getProvider('default');

        foreach ($rules as $name => $rule) {
            $result = $rule->process($data[$field], $this->_providers, compact('newRecord', 'data', 'field'));
            if ($result === true) {
                continue;
            }

            if (is_array($result) && $name === static::NESTED) {
                $errors = $result;
            } elseif (is_string($result)) {
                $errors[$name] = $result;
            } else {
                $args = $rule->get('pass');
                $errors[$name] = __d($this->_validationDomain, $name, $this->_translateArgs($args));
            }

            if ($rule->isLast()) {
                break;
            }
        }

        return $errors;
    }
protected function _processRules ( $ field , ValidationSet $ rules , $ data , $ newRecord ) { $ errors = [ ] ; // Loading default provider in case there is none $ this -> getProvider ( 'default' ) ; foreach ( $ rules as $ name => $ rule ) { $ result = $ rule -> process ( $ data [ $ field ] , $ this -> _providers , compact ( 'newRecord' , 'data' , 'field' ) ) ; if ( $ result === true ) { continue ; } if ( is_array ( $ result ) && $ name === static :: NESTED ) { $ errors = $ result ; } elseif ( is_string ( $ result ) ) { $ errors [ $ name ] = $ result ; } else { $ args = $ rule -> get ( 'pass' ) ; $ errors [ $ name ] = __d ( $ this -> _validationDomain , $ name , $ this -> _translateArgs ( $ args ) ) ; } if ( $ rule -> isLast ( ) ) { break ; } } return $ errors ; }
Iterates over each rule in the validation set and collects the errors resulting
from executing them.

@param string $field The name of the field that is being processed
@param \Cake\Validation\ValidationSet $rules the list of rules for a field
@param array $data the full data passed to the validator
@param bool $newRecord whether is it a new record or an existing one

@return array
Iterates over each rule in the validation set and collects the errors resulting from executing them .