/**
* @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
*/
private function getDecodedCollection(Criteria
$criteria, EntityCollection
$collection, EntityDefinition
$definition, string
$baseUrl): array
{ $decoded =
[];