/**
  * @param array $id
  *
  * @return array
  */
 public static function getIdValue(array $id) : array
 {
     self::formatScalarValues($id);
     if (\is_array($id)) {
         RecursiveDeleteHelper::deleteKeys($id, [Serializer::CLASS_IDENTIFIER_KEY]);
     }
     return $id;
 }
Ejemplo n.º 2
0
 /**
  * @param array $value
  *
  * @return mixed
  */
 protected function serializeObject(array $value)
 {
     if (null !== $this->mappings) {
         /** @var \NilPortugues\Api\Mapping\Mapping $mapping */
         foreach ($this->mappings as $class => $mapping) {
             RecursiveDeleteHelper::deleteProperties($this->mappings, $value, $class);
             RecursiveRenamerHelper::renameKeyValue($this->mappings, $value, $class);
         }
     }
     $this->setResponseMeta($value);
     $this->setResponseLinks($value);
     self::formatScalarValues($value);
     RecursiveDeleteHelper::deleteKeys($value, [Serializer::CLASS_IDENTIFIER_KEY]);
     self::flattenObjectsWithSingleKeyScalars($value);
     $this->recursiveSetKeysToUnderScore($value);
     return $value;
 }
Ejemplo n.º 3
0
 /**
  * @param array $idProperties
  * @param array $idValues
  */
 protected static function removeArraysFromKeyValueReplacement(array &$idProperties, array &$idValues)
 {
     RecursiveDeleteHelper::deleteKeys($idValues, [Serializer::CLASS_IDENTIFIER_KEY]);
     RecursiveFormatterHelper::flattenObjectsWithSingleKeyScalars($idValues);
     if (is_array($idValues)) {
         foreach ($idValues as $key => $value) {
             if (is_array($value)) {
                 unset($idProperties[$key]);
                 unset($idValues[$key]);
             }
         }
     }
 }
 /**
  * @param array $data
  *
  * @return array
  */
 protected function postSerialization(array $data)
 {
     $this->formatScalarValues($data);
     RecursiveDeleteHelper::deleteKeys($data, [Serializer::CLASS_IDENTIFIER_KEY]);
     return $data;
 }
Ejemplo n.º 5
0
 /**
  * @param array $data
  *
  * @return array
  */
 protected function postSerialization(array &$data)
 {
     RecursiveDeleteHelper::deleteKeys($data, [Serializer::CLASS_IDENTIFIER_KEY]);
     RecursiveDeleteHelper::deleteKeys($data, [Serializer::MAP_TYPE]);
     RecursiveFormatterHelper::formatScalarValues($data);
     AttributeFormatterHelper::flattenObjectsWithSingleKeyScalars($data);
     $this->recursiveSetKeysToUnderScore($data);
     $this->setResponseMeta($data);
     return $data;
 }