/** * Returns a middleware stack that will be processed by the router middleware. * @param Container $container The container used to create the stack * @param Route $route The route that was mapped to the request * @return MiddlewareStack Middleware stack to call to process the route */ private function getRouteHandlerStack(Container $container, Route $route) : MiddlewareStack { $stack = new MiddlewareStack(); $stack->push($this->resolveCallable($container, $route->getHandler())); return $stack; }
/** * Pushes the route dispatcher to the stack. * @param MiddlewareStack $stack The stack to use */ private function pushDispatcher(MiddlewareStack $stack) { $middleware = $this->loadMiddleware('config.phurity.dispatcher', DispatcherMiddleware::class, function () { return new DispatcherMiddleware($this->container); }); if ($middleware !== null) { $stack->push($middleware); } }