php-ze-ph.Factory.php.mustache Maven / Gradle / Ivy
get(Middleware\InternalServerError::class);
if (!($errorMiddleware instanceof Middleware\InternalServerError)) {
throw new \LogicException(\sprintf(
'Invalid error middleware: expecting %s, not %s.',
Middleware\InternalServerError::class,
\is_object($errorMiddleware) ? \get_class($errorMiddleware) : \gettype($errorMiddleware)
));
}
$pipeline = new MiddlewarePipe();
$runner = new RequestHandlerRunner(
$pipeline,
$container->get(EmitterInterface::class),
$container->get(ServerRequestInterface::class),
function(\Throwable $error) use ($errorMiddleware) : ResponseInterface
{
return $errorMiddleware->handleError($error);
}
);
$application = new Application(
$container->get(MiddlewareFactory::class),
$pipeline,
$container->get(RouteCollector::class),
$runner
);
$application->pipe($errorMiddleware);
$application->pipe(RouteMiddleware::class);
$application->pipe(MethodNotAllowedMiddleware::class);
$application->pipe(DispatchMiddleware::class);
$application->pipe(NotFoundHandler::class);
return $application;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy