original_string: protected function _mergeFieldValues(array $newFieldData, array $oldFieldData, \Gems_Tracker_Engine_TrackEngineInterface $trackEngine)
      {
          $fieldMap = $trackEngine->getFieldsDefinition()->getFieldCodes();
          $output   = array();
  
          foreach ($fieldMap as $key => $code) {
              if ($code) {
                  if (array_key_exists($code, $newFieldData)) {
                      $output[$key]  = $newFieldData[$code];
                      $output[$code] = $newFieldData[$code];
                  } elseif (array_key_exists($key, $newFieldData)) {
                      $output[$key]  = $newFieldData[$key];
                      $output[$code] = $newFieldData[$key];
                  } elseif (isset($oldFieldData[$code])) {
                      $output[$key]  = $oldFieldData[$code];
                      $output[$code] = $oldFieldData[$code];
                  } elseif (isset($oldFieldData[$key])) {
                      $output[$key]  = $oldFieldData[$key];
                      $output[$code] = $oldFieldData[$key];
                  } else {
                      $output[$key]  = null;
                      $output[$code] = null;
                  }
              } else {
                  if (array_key_exists($key, $newFieldData)) {
                      $output[$key]  = $newFieldData[$key];
                  } elseif (isset($oldFieldData[$key])) {
                      $output[$key]  = $oldFieldData[$key];
                  } else {
                      $output[$key]  = null;
                  }
              }
          }
  
          return $output;
      }
code: protected function _mergeFieldValues(array $newFieldData, array $oldFieldData, \Gems_Tracker_Engine_TrackEngineInterface $trackEngine)
      {
          $fieldMap = $trackEngine->getFieldsDefinition()->getFieldCodes();
          $output   = array();
  
          foreach ($fieldMap as $key => $code) {
              if ($code) {
                  if (array_key_exists($code, $newFieldData)) {
                      $output[$key]  = $newFieldData[$code];
                      $output[$code] = $newFieldData[$code];
                  } elseif (array_key_exists($key, $newFieldData)) {
                      $output[$key]  = $newFieldData[$key];
                      $output[$code] = $newFieldData[$key];
                  } elseif (isset($oldFieldData[$code])) {
                      $output[$key]  = $oldFieldData[$code];
                      $output[$code] = $oldFieldData[$code];
                  } elseif (isset($oldFieldData[$key])) {
                      $output[$key]  = $oldFieldData[$key];
                      $output[$code] = $oldFieldData[$key];
                  } else {
                      $output[$key]  = null;
                      $output[$code] = null;
                  }
              } else {
                  if (array_key_exists($key, $newFieldData)) {
                      $output[$key]  = $newFieldData[$key];
                  } elseif (isset($oldFieldData[$key])) {
                      $output[$key]  = $oldFieldData[$key];
                  } else {
                      $output[$key]  = null;
                  }
              }
          }
  
          return $output;
      }
code_tokens: protected function _mergeFieldValues ( array $ newFieldData , array $ oldFieldData , \ Gems_Tracker_Engine_TrackEngineInterface $ trackEngine ) { $ fieldMap = $ trackEngine -> getFieldsDefinition ( ) -> getFieldCodes ( ) ; $ output = array ( ) ; foreach ( $ fieldMap as $ key => $ code ) { if ( $ code ) { if ( array_key_exists ( $ code , $ newFieldData ) ) { $ output [ $ key ] = $ newFieldData [ $ code ] ; $ output [ $ code ] = $ newFieldData [ $ code ] ; } elseif ( array_key_exists ( $ key , $ newFieldData ) ) { $ output [ $ key ] = $ newFieldData [ $ key ] ; $ output [ $ code ] = $ newFieldData [ $ key ] ; } elseif ( isset ( $ oldFieldData [ $ code ] ) ) { $ output [ $ key ] = $ oldFieldData [ $ code ] ; $ output [ $ code ] = $ oldFieldData [ $ code ] ; } elseif ( isset ( $ oldFieldData [ $ key ] ) ) { $ output [ $ key ] = $ oldFieldData [ $ key ] ; $ output [ $ code ] = $ oldFieldData [ $ key ] ; } else { $ output [ $ key ] = null ; $ output [ $ code ] = null ; } } else { if ( array_key_exists ( $ key , $ newFieldData ) ) { $ output [ $ key ] = $ newFieldData [ $ key ] ; } elseif ( isset ( $ oldFieldData [ $ key ] ) ) { $ output [ $ key ] = $ oldFieldData [ $ key ] ; } else { $ output [ $ key ] = null ; } } } return $ output ; }
docstring: Processes the field values and returns the new complete field data
  
  @param array $newFieldData The new field values, may be partial, field set by code overwrite field set by key
  @param array $oldFieldData The old field values
  @param \Gems_Tracker_Engine_TrackEngineInterface $trackEngine
  @return array The processed data in the format key1 => val1, code1 => val1, key2 => val2
docstring_tokens: Processes the field values and returns the new complete field data