/** * Build a kernel for a specific route * * Using StackedHttpKernel factory for better reusability * * @param array $routeParameters Parameters of the route * * @return \Stack\StackedHttpKernel */ protected function getStack($routeParameters) { $route = $this->routeCollection->get($routeParameters['_route']); $dispatch = $route->getOption('dispatch'); $services = array(); $parameters = array(); $factory = new StackedHttpKernel($this->container, $dispatch); list($name, $stack) = $factory->register(null, 'pyrite.root_kernel', $dispatch); return $stack; }
/** * @param Request $request * @param int $type * @param bool $catch * * @return Response * @throws \Exception */ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) { if (false === $this->config->get('debug')) { $this->registerFatalErrorHandler(); } $factory = new StackedHttpKernel($this->container, $dispatch = $request->attributes->get('dispatch')); list($name, $this->stack) = $factory->register($this, 'pyrite.root_kernel', $dispatch); return $this->stack->handle($request, $type, $catch); }