Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Dispatcher
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 dispatch
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Router;
6
7use Psr\Container\ContainerInterface as Container;
8use Psr\Http\Message\ResponseInterface as Response;
9use Psr\Http\Message\ServerRequestInterface as Request;
10
11/** @psalm-api */
12final 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}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Dispatcher->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    }