return $this ->serializer
->
denormalize($normalized,
$class,
$format,
$context);
} /**
* {@inheritdoc}
*/
public function normalize($object,
$format = NULL, array
$context =
[]): array|string|int|float|bool|\ArrayObject|NULL
{ assert($object instanceof JsonApiDocumentTopLevel
);
$data =
$object->
getData();
$document['jsonapi'
] = CacheableNormalization::
permanent([ 'version' => JsonApiSpec::SUPPORTED_SPECIFICATION_VERSION,
'meta' =>
[ 'links' =>
[ 'self' =>
[ 'href' => JsonApiSpec::SUPPORTED_SPECIFICATION_PERMALINK,
],
],
],
]);
if ($data instanceof ErrorCollection
) { $document['errors'
] =
$this->
normalizeErrorDocument($object,
$format,
$context);
}