original_string: protected function _processRules($field, ValidationSet $rules, $data, $newRecord)
      {
          $errors = [];
          // Loading default provider in case there is none
          $this->getProvider('default');
          $message = 'The provided value is invalid';
  
          if ($this->_useI18n) {
              $message = __d('cake', 'The provided value is invalid');
          }
  
          foreach ($rules as $name => $rule) {
              $result = $rule->process($data[$field], $this->_providers, compact('newRecord', 'data', 'field'));
              if ($result === true) {
                  continue;
              }
  
              $errors[$name] = $message;
              if (is_array($result) && $name === static::NESTED) {
                  $errors = $result;
              }
              if (is_string($result)) {
                  $errors[$name] = $result;
              }
  
              if ($rule->isLast()) {
                  break;
              }
          }
  
          return $errors;
      }
code: protected function _processRules($field, ValidationSet $rules, $data, $newRecord)
      {
          $errors = [];
          // Loading default provider in case there is none
          $this->getProvider('default');
          $message = 'The provided value is invalid';
  
          if ($this->_useI18n) {
              $message = __d('cake', 'The provided value is invalid');
          }
  
          foreach ($rules as $name => $rule) {
              $result = $rule->process($data[$field], $this->_providers, compact('newRecord', 'data', 'field'));
              if ($result === true) {
                  continue;
              }
  
              $errors[$name] = $message;
              if (is_array($result) && $name === static::NESTED) {
                  $errors = $result;
              }
              if (is_string($result)) {
                  $errors[$name] = $result;
              }
  
              if ($rule->isLast()) {
                  break;
              }
          }
  
          return $errors;
      }
code_tokens: protected function _processRules ( $ field , ValidationSet $ rules , $ data , $ newRecord ) { $ errors = [ ] ; // Loading default provider in case there is none $ this -> getProvider ( 'default' ) ; $ message = 'The provided value is invalid' ; if ( $ this -> _useI18n ) { $ message = __d ( 'cake' , 'The provided value is invalid' ) ; } foreach ( $ rules as $ name => $ rule ) { $ result = $ rule -> process ( $ data [ $ field ] , $ this -> _providers , compact ( 'newRecord' , 'data' , 'field' ) ) ; if ( $ result === true ) { continue ; } $ errors [ $ name ] = $ message ; if ( is_array ( $ result ) && $ name === static :: NESTED ) { $ errors = $ result ; } if ( is_string ( $ result ) ) { $ errors [ $ name ] = $ result ; } if ( $ rule -> isLast ( ) ) { break ; } } return $ errors ; }
docstring: 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
docstring_tokens: Iterates over each rule in the validation set and collects the errors resulting from executing them