request = $request; $this->response = $response; $this->args = $args; $this->routeContext = RouteContext::fromRequest($this->request); return $this->respond($request, $response); } /** * Implement this method for handling the request. * * @return Response */ abstract public function respond(): Response; /** * Render the given Template. * * @param string $templateName The name of the template * @param array $data The data for the template * @return Response */ public function render(string $templateName, array $data = []): Response { $view = Twig::fromRequest($this->request); return $view->render($this->response, $templateName, $data); } }