function TraceableSerializer::normalize
Overrides NormalizerInterface::normalize
File
-
vendor/
symfony/ serializer/ Debug/ TraceableSerializer.php, line 69
Class
- TraceableSerializer
- Collects some data about serialization.
Namespace
Symfony\Component\Serializer\DebugCode
public function normalize(mixed $object, ?string $format = null, array $context = []) : array|string|int|float|bool|\ArrayObject|null {
$context[self::DEBUG_TRACE_ID] = $traceId = bin2hex(random_bytes(4));
$startTime = microtime(true);
$result = $this->serializer
->normalize($object, $format, $context);
$time = microtime(true) - $startTime;
$caller = $this->getCaller(__FUNCTION__, NormalizerInterface::class);
$this->dataCollector
->collectNormalize($traceId, $object, $format, $context, $time, $caller, $this->serializerName);
return $result;
}