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}