Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| RoutingHandler | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| handle | |
100.00% |
5 / 5 |
|
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 Override; |
| 8 | use Psr\Container\ContainerInterface as Container; |
| 9 | use Psr\Http\Message\ResponseInterface as Response; |
| 10 | use Psr\Http\Message\ServerRequestInterface as Request; |
| 11 | use Psr\Http\Server\RequestHandlerInterface as RequestHandler; |
| 12 | |
| 13 | /** @psalm-api */ |
| 14 | final class RoutingHandler implements RequestHandler |
| 15 | { |
| 16 | public function __construct( |
| 17 | private readonly Router $router, |
| 18 | private readonly Dispatcher $dispatcher, |
| 19 | private readonly ?Container $container = null, |
| 20 | ) {} |
| 21 | |
| 22 | #[Override] |
| 23 | public function handle(Request $request): Response |
| 24 | { |
| 25 | return $this->dispatcher->dispatch( |
| 26 | $request, |
| 27 | $this->router->match($request), |
| 28 | $this->container, |
| 29 | ); |
| 30 | } |
| 31 | } |
Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not
necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once.
Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 17 | private readonly Router $router, |
| 18 | private readonly Dispatcher $dispatcher, |
| 19 | private readonly ?Container $container = null, |
| 20 | ) {} |
| 23 | public function handle(Request $request): Response |
| 24 | { |
| 25 | return $this->dispatcher->dispatch( |
| 26 | $request, |
| 27 | $this->router->match($request), |
| 28 | $this->container, |
| 29 | ); |
| 30 | } |