Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TraceableNormalizer.php

function TraceableNormalizer::denormalize

Overrides DenormalizerInterface::denormalize

File

vendor/symfony/serializer/Debug/TraceableNormalizer.php, line 69

Class

TraceableNormalizer
Collects some data about normalization.

Namespace

Symfony\Component\Serializer\Debug

Code

public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []) : mixed {
    if (!$this->normalizer instanceof DenormalizerInterface) {
        throw new \BadMethodCallException(\sprintf('The "%s()" method cannot be called as nested normalizer doesn\'t implements "%s".', __METHOD__, DenormalizerInterface::class));
    }
    $startTime = microtime(true);
    $denormalized = $this->normalizer
        ->denormalize($data, $type, $format, $context);
    $time = microtime(true) - $startTime;
    if ($traceId = $context[TraceableSerializer::DEBUG_TRACE_ID] ?? null) {
        $this->dataCollector
            ->collectDenormalization($traceId, $this->normalizer::class, $time, $this->serializerName);
    }
    return $denormalized;
}
RSS feed
Powered by Drupal