/** * @param HalApiControllerParameters $parameters */ public function __construct(HalApiControllerParameters $parameters) { $this->app = $parameters->getApplication(); $this->linkFactory = $parameters->getLinkFactory(); $this->representationFactory = $parameters->getRepresentationFactory(); $this->routeHelper = $parameters->getRouteHelper(); $this->responseFactory = $parameters->getResponseFactory(); $this->request = $parameters->getRequest(); $this->parameters = new SafeIndexArray($this->request->input()); $this->body = new SafeIndexArray($this->request->json()->all()); /** @var Route $route */ $route = $this->request->route(); if ($route) { $routeParameters = $route->parameters(); $this->self = $this->linkFactory->create($route, $routeParameters); $this->parent = $this->linkFactory->create($this->routeHelper->parent($route), $routeParameters); } }