1 | <?php |
||
14 | class Dispatcher |
||
15 | { |
||
16 | /** |
||
17 | * Inner dispatcher. |
||
18 | * |
||
19 | * @var BaseDispatcher |
||
20 | */ |
||
21 | private $router; |
||
22 | |||
23 | /** |
||
24 | * Service Container |
||
25 | * |
||
26 | * @var ContainerInterface |
||
27 | */ |
||
28 | private $container; |
||
29 | |||
30 | /** |
||
31 | * Class constructor with required FastRoute dispatcher implementation. |
||
32 | * |
||
33 | * @param BaseDispatcher $router Inner router (based on Nikic FastRouter). |
||
34 | * @param ContainerInterface $container Dependency Injection container. |
||
35 | */ |
||
36 | 17 | public function __construct(BaseDispatcher $router, ContainerInterface $container) |
|
41 | |||
42 | /** |
||
43 | * Dispatching. |
||
44 | * |
||
45 | * @param RequestInterface $request Representation of an outgoing, |
||
46 | * client-side request. |
||
47 | * |
||
48 | * @throws RouteNotFoundException If the route is not found. |
||
49 | * @throws MethodNotAllowedException If the method is not allowed. |
||
50 | * @throws Exception If no one case is matched. |
||
51 | * |
||
52 | * @return RouteInfo |
||
53 | */ |
||
54 | 16 | public function __invoke(RequestInterface $request) |
|
75 | |||
76 | /** |
||
77 | * Process RouteInfo instance |
||
78 | * |
||
79 | * @param array $dispatch |
||
80 | * |
||
81 | * @return RouteInfo |
||
82 | */ |
||
83 | 11 | private function processRouteInfo(array $dispatch) |
|
93 | } |
||
94 |