original_string: protected function extra_validation($data, $files, array &$errors) {
          $overrides = $this->get_role_overrides_from_data($data);
  
          // Check role overrides to ensure that:
          // - roles are unique; and
          // - specifeid retention periods are numeric.
          $seenroleids = [];
          foreach ($overrides as $id => $override) {
              $override->purposeid = 0;
              $persistent = new \tool_dataprivacy\purpose_override($override->id, $override);
  
              if (isset($seenroleids[$persistent->get('roleid')])) {
                  $errors["roleoverride_roleid[{$id}]"] = get_string('duplicaterole');
              }
              $seenroleids[$persistent->get('roleid')] = true;
  
              $errors = array_merge($errors, $persistent->get_errors());
          }
  
          return $errors;
      }
code: protected function extra_validation($data, $files, array &$errors) {
          $overrides = $this->get_role_overrides_from_data($data);
  
          // Check role overrides to ensure that:
          // - roles are unique; and
          // - specifeid retention periods are numeric.
          $seenroleids = [];
          foreach ($overrides as $id => $override) {
              $override->purposeid = 0;
              $persistent = new \tool_dataprivacy\purpose_override($override->id, $override);
  
              if (isset($seenroleids[$persistent->get('roleid')])) {
                  $errors["roleoverride_roleid[{$id}]"] = get_string('duplicaterole');
              }
              $seenroleids[$persistent->get('roleid')] = true;
  
              $errors = array_merge($errors, $persistent->get_errors());
          }
  
          return $errors;
      }
code_tokens: protected function extra_validation ( $ data , $ files , array & $ errors ) { $ overrides = $ this -> get_role_overrides_from_data ( $ data ) ; // Check role overrides to ensure that: // - roles are unique; and // - specifeid retention periods are numeric. $ seenroleids = [ ] ; foreach ( $ overrides as $ id => $ override ) { $ override -> purposeid = 0 ; $ persistent = new \ tool_dataprivacy \ purpose_override ( $ override -> id , $ override ) ; if ( isset ( $ seenroleids [ $ persistent -> get ( 'roleid' ) ] ) ) { $ errors [ "roleoverride_roleid[{$id}]" ] = get_string ( 'duplicaterole' ) ; } $ seenroleids [ $ persistent -> get ( 'roleid' ) ] = true ; $ errors = array_merge ( $ errors , $ persistent -> get_errors ( ) ) ; } return $ errors ; }
docstring: Define extra validation mechanims.
  
  @param  stdClass $data Data to validate.
  @param  array $files Array of files.
  @param  array $errors Currently reported errors.
  @return array of additional errors, or overridden errors.
docstring_tokens: Define extra validation mechanims .