/**
  * {@inheritDoc}
  */
 public function format($value, $fieldName, array $fieldDefinition, $context = null)
 {
     if (!empty($fieldDefinition['eval']['isAssociative']) || !empty($fieldDefinition['options']) && array_is_assoc($fieldDefinition['options'])) {
         if (!empty($fieldDefinition['options'][$value])) {
             $value = $fieldDefinition['options'][$value];
         }
     } elseif (!empty($fieldDefinition['options_callback'])) {
         if ($context instanceof DataContainer) {
             $options = $this->invoker->invoke($fieldDefinition['options_callback'], [$context]);
         } else {
             $options = $this->invoker->invoke($fieldDefinition['options_callback']);
         }
         if (!empty($options[$value])) {
             $value = $options[$value];
         }
     }
     return $value;
 }
 /**
  * Execute save callbacks.
  *
  * @param Definition $definition Data container definition.
  * @param array      $data       Data row.
  * @param mixed      $context    Context, usually the data container driver.
  *
  * @return array
  */
 private function executeSaveCallbacks(Definition $definition, array $data, $context)
 {
     foreach ($data as $column => $value) {
         $callbacks = $definition->get(['fields', $column, 'save_callback']);
         if (is_array($callbacks)) {
             $data[$column] = $this->invoker->invokeAll($callbacks, [$value, $context], 0);
         }
     }
     return $data;
 }