public function __construct(private readonly NormalizerInterface
$serializer) { } /**
* @param EntityCollection<Entity>|Entity|null $data
*/
public function encode(Criteria
$criteria, EntityDefinition
$definition,
$data, string
$baseUrl): array
{ if ((!
$data instanceof EntityCollection
) && (!
$data instanceof Entity
)) { throw new UnsupportedEncoderInputException();
} if ($data instanceof EntityCollection
) { return $this->
getDecodedCollection($criteria,
$data,
$definition,
$baseUrl);
} return $this->
getDecodedEntity($criteria,
$data,
$definition,
$baseUrl);
} /**
* @param EntityCollection<Entity> $collection
*/