-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathApplicationHandler.php
More file actions
32 lines (26 loc) · 874 Bytes
/
ApplicationHandler.php
File metadata and controls
32 lines (26 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Http\Handler;
use PhpMyAdmin\Application;
use PhpMyAdmin\Exceptions\ExitException;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\ResponseRenderer;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use function assert;
final readonly class ApplicationHandler implements RequestHandlerInterface
{
public function __construct(private Application $application, private ResponseRenderer $responseRenderer)
{
}
public function handle(ServerRequestInterface $request): ResponseInterface
{
assert($request instanceof ServerRequest);
try {
return $this->application->handle($request);
} catch (ExitException) {
return $this->responseRenderer->response();
}
}
}