Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Dispatcher | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| dispatch | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Router; |
| 6 | |
| 7 | use Psr\Container\ContainerInterface as Container; |
| 8 | use Psr\Http\Message\ResponseInterface as Response; |
| 9 | use Psr\Http\Message\ServerRequestInterface as Request; |
| 10 | |
| 11 | /** @psalm-api */ |
| 12 | final class Dispatcher |
| 13 | { |
| 14 | use AddsBeforeAfter; |
| 15 | use AddsMiddleware; |
| 16 | |
| 17 | public function dispatch( |
| 18 | Request $request, |
| 19 | RouteMatch $match, |
| 20 | ?Container $container = null, |
| 21 | ): Response { |
| 22 | $view = new View($match, $container, $this->beforeHandlers, $this->afterHandlers); |
| 23 | $handler = new ViewHandler($view, $this->middleware); |
| 24 | |
| 25 | return $handler->handle($request); |
| 26 | } |
| 27 | } |