function TraceableEncoder::decode
Overrides DecoderInterface::decode
File
-
vendor/
symfony/ serializer/ Debug/ TraceableEncoder.php, line 63
Class
- TraceableEncoder
- Collects some data about encoding.
Namespace
Symfony\Component\Serializer\DebugCode
public function decode(string $data, string $format, array $context = []) : mixed {
if (!$this->encoder instanceof DecoderInterface) {
throw new \BadMethodCallException(\sprintf('The "%s()" method cannot be called as nested encoder doesn\'t implements "%s".', __METHOD__, DecoderInterface::class));
}
$startTime = microtime(true);
$encoded = $this->encoder
->decode($data, $format, $context);
$time = microtime(true) - $startTime;
if ($traceId = $context[TraceableSerializer::DEBUG_TRACE_ID] ?? null) {
$this->dataCollector
->collectDecoding($traceId, $this->encoder::class, $time, $this->serializerName);
}
return $encoded;
}