original_string: protected function enrichField($key, ModelShowFieldDataInterface $field, array &$fields)
      {
          $normalizedRelationName = $this->normalizeRelationName($key);
  
          // Check if we can enrich, if we must.
          if (    ! isset($this->info->attributes[ $key ])
              &&  ! isset($this->info->relations[ $normalizedRelationName ])
          ) {
              // If the field data is fully set, no need to enrich
              if ($this->isShowFieldDataComplete($field)) {
                  $fields[ $key ] = $field;
                  return;
              }
  
              throw new UnexpectedValueException(
                  "Incomplete data for for show field key that does not match known model attribute or relation method. "
                  . "Requires at least 'source' and 'strategy' values."
              );
          }
  
          if (isset($this->info->attributes[ $key ])) {
              $attributeFieldInfo = $this->makeModelShowFieldDataForAttributeData($this->info->attributes[ $key ], $this->info);
          } else {
              // get from relation data
              $attributeFieldInfo = $this->makeModelShowFieldDataForRelationData(
                  $this->info->relations[ $normalizedRelationName ],
                  $this->info
              );
          }
  
          $attributeFieldInfo->merge($field);
  
          $fields[ $key ] = $attributeFieldInfo;
      }
code: protected function enrichField($key, ModelShowFieldDataInterface $field, array &$fields)
      {
          $normalizedRelationName = $this->normalizeRelationName($key);
  
          // Check if we can enrich, if we must.
          if (    ! isset($this->info->attributes[ $key ])
              &&  ! isset($this->info->relations[ $normalizedRelationName ])
          ) {
              // If the field data is fully set, no need to enrich
              if ($this->isShowFieldDataComplete($field)) {
                  $fields[ $key ] = $field;
                  return;
              }
  
              throw new UnexpectedValueException(
                  "Incomplete data for for show field key that does not match known model attribute or relation method. "
                  . "Requires at least 'source' and 'strategy' values."
              );
          }
  
          if (isset($this->info->attributes[ $key ])) {
              $attributeFieldInfo = $this->makeModelShowFieldDataForAttributeData($this->info->attributes[ $key ], $this->info);
          } else {
              // get from relation data
              $attributeFieldInfo = $this->makeModelShowFieldDataForRelationData(
                  $this->info->relations[ $normalizedRelationName ],
                  $this->info
              );
          }
  
          $attributeFieldInfo->merge($field);
  
          $fields[ $key ] = $attributeFieldInfo;
      }
code_tokens: protected function enrichField ( $ key , ModelShowFieldDataInterface $ field , array & $ fields ) { $ normalizedRelationName = $ this -> normalizeRelationName ( $ key ) ; // Check if we can enrich, if we must. if ( ! isset ( $ this -> info -> attributes [ $ key ] ) && ! isset ( $ this -> info -> relations [ $ normalizedRelationName ] ) ) { // If the field data is fully set, no need to enrich if ( $ this -> isShowFieldDataComplete ( $ field ) ) { $ fields [ $ key ] = $ field ; return ; } throw new UnexpectedValueException ( "Incomplete data for for show field key that does not match known model attribute or relation method. " . "Requires at least 'source' and 'strategy' values." ) ; } if ( isset ( $ this -> info -> attributes [ $ key ] ) ) { $ attributeFieldInfo = $ this -> makeModelShowFieldDataForAttributeData ( $ this -> info -> attributes [ $ key ] , $ this -> info ) ; } else { // get from relation data $ attributeFieldInfo = $ this -> makeModelShowFieldDataForRelationData ( $ this -> info -> relations [ $ normalizedRelationName ] , $ this -> info ) ; } $ attributeFieldInfo -> merge ( $ field ) ; $ fields [ $ key ] = $ attributeFieldInfo ; }
docstring: Enriches a single show field and saves the data.
  
  @param ModelShowFieldDataInterface $field
  @param string                      $key
  @param array                       $fields       by reference, data array to build, updated with enriched data
docstring_tokens: Enriches a single show field and saves the data .