Chris@0: app = $app; Chris@0: $this->middlewares = $middlewares; Chris@0: } Chris@0: Chris@0: public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) Chris@0: { Chris@0: return $this->app->handle($request, $type, $catch); Chris@0: } Chris@0: Chris@0: public function terminate(Request $request, Response $response) Chris@0: { Chris@0: $prevKernel = null; Chris@0: foreach ($this->middlewares as $kernel) { Chris@0: // if prev kernel was terminable we can assume this middleware has already been called Chris@0: if (!$prevKernel instanceof TerminableInterface && $kernel instanceof TerminableInterface) { Chris@0: $kernel->terminate($request, $response); Chris@0: } Chris@0: $prevKernel = $kernel; Chris@0: } Chris@0: } Chris@0: }