public function __invoke(string $shortName) : array
{
if ('Entrypoint' === $shortName) {
return ['@context' => $this->contextBuilder->getEntrypointContext()];
}
if (isset(self::RESERVED_SHORT_NAMES[$shortName])) {
return ['@context' => $this->contextBuilder->getBaseContext()];
}
foreach ($this->resourceNameCollectionFactory->create() as $resourceClass) {
$resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);
if ($shortName === $resourceMetadata->getShortName()) {
return ['@context' => $this->contextBuilder->getResourceContext($resourceClass)];
}
}
throw new NotFoundHttpException();
}