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\DebugCode
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;
}