@param array  $data
@param string $class
@param string $format
@param array  $context

@return object
487962
public function denormalize($data, $class, $format = null, array $context = array())
    {
        if (!($_class = $this->getClassFromArray($data))) {
            return parent::denormalize($data, $class, $format, $context);
        }

        $class = $_class;

        return parent::denormalize($data, $class, $format, $context);
    }
535231
public function get(array $data, $className, callable $callable)
    {
        try {
            DataObject::assertPost($data, $this->serializer, $className, $this->errorBag);

            $values = DataObject::getAttributes($data, $this->serializer);
            $model = $callable($data, $values, $this->errorBag);

            $response = $this->resourceCreated($this->serializer->serialize($model));
        } catch (Exception $e) {
            $response = $this->getErrorResponse($e, $this->errorBag);
        }

        return $response;
    }
961053
protected function denormalizeCollection($collection, $class, $name, $format = null, array $context = array())
    {
        /** @var ClassMetadata $meta */
        $meta = $context['entityMeta'];

        $targetEntity = $meta->associationMappings[$name]['targetEntity'];

        $result = array();
        foreach ($collection as $key => $element) {
            $class = $class ?: $targetEntity;

            $result[$key] = $this->denormalizeAssociation($element, $class, $name, $format, $context);
        }

        return $result;
    }
1334136
public function deserialize($class, $data)
    {
        $document = $this->documentRepo->findOneBy(['uuid' => $data['id']]);

        if (empty($document)) {
            $document = new Document();
            $document->setUuid($data['id']);

            /** @var Drop $drop */
            $drop = $this->dropRepo->findOneBy(['uuid' => $data['drop']]);
            $document->setDrop($drop);
            $currentUser = $this->tokenStorage->getToken()->getUser();

            if ($currentUser instanceof User) {
                $document->setUser($currentUser);
            }
            $document->setDropDate(new \DateTime());
        }
        if (isset($data['type'])) {
            $document->setType($data['type']);

            if (isset($data['data'])) {
                $documentData = Document::DOCUMENT_TYPE_RESOURCE === $document->getType() ?
                    $this->resourceNodeRepo->findOneBy(['uuid' => $data['data']]) :
                    $data['data'];
                $document->setData($documentData);
            }
        }

        return $document;
    }
470999
public function denormalize($data, $type, $format = null, array $context = [])
    {
        if (!$this->normalizers) {
            throw new LogicException('You must register at least one normalizer to be able to denormalize objects.');
        }

        if ($normalizer = $this->getDenormalizer($data, $type, $format, $context)) {
            return $normalizer->denormalize($data, $type, $format, $context);
        }

        throw new NotNormalizableValueException(sprintf('Could not denormalize object of type %s, no supporting normalizer found.', $type));
    }
81446
public function normalize($object, $format = null, array $context = [])
    {
        $normalized = [];
        foreach ($object->getDefinition()->getFields() as $field) {
            if (isset($object->{$key = $field->getName()})) {
                if ($field instanceof SerializerAwareInterface) {
                    $field->setSerializer($this->serializer);
                }

                $normalized[$key] = $field->normalize($object->{$key}, $format, $context);
            }
        }

        return $normalized;
    }
552010
public function normalize($object, $format = null, array $context = array())
    {
        $data = parent::normalize($object, $format, $context);

        if (!is_array($data)) {
            return $data;
        }

        return array_merge($this->getHintFromObject($object), $data);
    }
820324
public function denormalize($string, $class, $format = null, array $context = array())
    {
        if (!preg_match(static::FULL_REGEX, $string, $matches)) {
            throw new \InvalidArgumentException('The provided "data:" URI is not valid.');
        }

        $mime = !empty($matches[static::CONTEXT_MIME]) ? $matches[static::CONTEXT_MIME] : 'application/octet-stream';
        $charset = !empty($matches[static::CONTEXT_CHARSET]) ? $matches[static::CONTEXT_CHARSET] : null;
        $gzip = strpos($mime, 'gzip') !== false;
        $base64 = !empty($matches[static::CONTEXT_BASE64]) ? $matches[static::CONTEXT_BASE64] : null;
        $urldecode = strpos($mime, 'text/') !== false;

        $string = $matches[static::CONTEXT_DATA];

        if ($base64) {
            $string = base64_decode($string);
        }
        if ($gzip) {
            $string = gzdecode($string);
        }
        if ($urldecode or !$base64) {
            $string = urldecode($string);
        }

        return $string;
    }
1270510
public function encode($data, $format, array $context = [])
    {
        $jsonEncodeOptions = $context[self::OPTIONS] ?? $this->defaultContext[self::OPTIONS];
        $encodedJson = json_encode($data, $jsonEncodeOptions);

        if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($jsonEncodeOptions & JSON_PARTIAL_OUTPUT_ON_ERROR))) {
            throw new NotEncodableValueException(json_last_error_msg());
        }

        return $encodedJson;
    }
1131161
public function format($data, $format)
    {
        // Case handing. ex. json => Json
        $format = ucfirst(strtolower($format));
        $formatFunc = "format" . $format;
        // Use formatter if exists
        if (method_exists($this, $formatFunc)) {
            
            $data = $this->{$formatFunc}($data);
        } 
        elseif (is_array($data)) {
            // Use JSON while the Formatter not found and the data is array
            $data = $this->formatJson($data);
        }

        return $data;
    }
1143938
public function denormalize($data, $class, $format = null, array $context = array())
    {
        if (isset($data['@references'])) {
            $context['@references'] = &$data['@references'];

            $ids = $this->getIdentifierFromArray($class, $data);
            $objectId = $class.'#'.$this->getIdentifiersAsString($ids);

            $context['@references'][$objectId] = $data;
            unset($context['@references'][$objectId]['@references']);
        }

        if (!isset($context['cache_key'])) {
            $context['cache_key'] = md5(serialize($context));
        }
        $class = $class ?: $this->getClassFromArray($data);
        $context['entityMeta'] = $this->entityMetadataFactory->getMetadataFor($class);
        $rc = new \ReflectionClass($class);
        $object = $this->instantiateObject($data, $class, $context, $rc, false);

        return $this->hydrateObject($object, $data, $class, $format, $context);
    }
587340
public function create($data, $class)
    {
        return is_object($data) ? $data : $this->hydrate(is_array($data) ? $data : [$data], $class);
    }
1053681
public function fromArray(
        array $data,
        $class,
        $document = null,
        $mode = self::UNSERIALIZE_PATCH
    ) {
        return $this->unserialize($data, $class, $document, $mode);
    }
1229801
public static function encode($data, array $context = [])
    {
        $context = array_merge(static::$defaultEncodeContext, $context);

        return static::encodeData($data, $context);
    }
705862
public function denormalize($values, $class, $format = null, array $context = array())
    {
        if (!is_array($values)) {
            return $values;
        }

        $filtered = array_filter(
            $values,
            function ($value) use ($class, $format) {
                return $this->serializer->supportsDenormalization($value, $class, $format);
            }
        );

        if (count($filtered) !== count($values)) {
            throw new \InvalidArgumentException('Not all values within the array can be denormalized.');
        }

        return array_map(
            function ($value) use ($class, $format, $context) {
                return $this->serializer->denormalize($value, $class, $format, $context);
            },
            $filtered
        );
    }
318059
public function normalize($object, $format = null, array $context = [])
    {
        if (isset($context['api_sub_level'])) {
            return $this->normalizeRawCollection($object, $format, $context);
        }

        try {
            $resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null, true);
        } catch (InvalidArgumentException $e) {
            if (!isset($context['resource_class'])) {
                return $this->normalizeRawCollection($object, $format, $context);
            }

            throw $e;
        }
        $data = [];
        $context = $this->initContext($resourceClass, $context);

        return array_merge_recursive(
            $data,
            $this->getPaginationData($object, $context),
            $this->getItemsData($object, $format, $context)
        );
    }
697210
public function load($data, $format = 'php')
    {
        if (!$data) {
            return $this;
        }

        if (\is_string($data) && \in_array($format, static::$formats, true)) {
            switch ($format) {
                case static::FORMAT_YML:
                    $this->loadYaml($data);
                    break;

                case static::FORMAT_JSON:
                    $this->loadJson($data);
                    break;

                case static::FORMAT_INI:
                    $this->loadIni($data);
                    break;

                case static::FORMAT_PHP:
                default:
                    $this->loadArray($data);
                    break;
            }

        } elseif (\is_array($data) || \is_object($data)) {
            $this->bindData($this->data, $data);
        }

        return $this;
    }