1 | <?php declare(strict_types=1); |
||
13 | class Dispatcher extends GroupCountBasedDispatcher implements |
||
14 | MiddlewareAwareInterface, |
||
15 | RequestHandlerInterface, |
||
16 | StrategyAwareInterface |
||
17 | { |
||
18 | use MiddlewareAwareTrait; |
||
19 | use StrategyAwareTrait; |
||
20 | |||
21 | /** |
||
22 | * Dispatch the current route |
||
23 | * |
||
24 | * @param \Psr\Http\Message\ServerRequestInterface $request |
||
25 | * |
||
26 | * @return \Psr\Http\Message\ResponseInterface |
||
27 | */ |
||
28 | 32 | public function dispatchRequest(ServerRequestInterface $request) : ResponseInterface |
|
50 | |||
51 | /** |
||
52 | * Ensure handler is a Route, honoring the contract of dispatchRequest. |
||
53 | * |
||
54 | * @param Route|mixed $matchingHandler |
||
55 | * @param string $httpMethod |
||
56 | * @param string $uri |
||
57 | * |
||
58 | * @return Route |
||
59 | * |
||
60 | */ |
||
61 | 16 | private function ensureHandlerIsRoute($matchingHandler, $httpMethod, $uri) : Route |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 32 | public function handle(ServerRequestInterface $request) : ResponseInterface |
|
78 | |||
79 | /** |
||
80 | * Set up middleware for a found route |
||
81 | * |
||
82 | * @param \League\Route\Route $route |
||
83 | * |
||
84 | * @return void |
||
85 | */ |
||
86 | 16 | protected function setFoundMiddleware(Route $route) : void |
|
105 | |||
106 | /** |
||
107 | * Set up middleware for a not found route |
||
108 | * |
||
109 | * @return void |
||
110 | */ |
||
111 | 12 | protected function setNotFoundDecoratorMiddleware() : void |
|
116 | |||
117 | /** |
||
118 | * Set up middleware for a not allowed route |
||
119 | * |
||
120 | * @param array $allowed |
||
121 | * |
||
122 | * @return void |
||
123 | */ |
||
124 | 4 | protected function setMethodNotAllowedDecoratorMiddleware(array $allowed) : void |
|
132 | } |
||
133 |