1 | <?php declare(strict_types=1); |
||
14 | class Dispatcher extends GroupCountBasedDispatcher implements |
||
15 | MiddlewareAwareInterface, |
||
16 | RequestHandlerInterface, |
||
17 | StrategyAwareInterface |
||
18 | { |
||
19 | use MiddlewareAwareTrait; |
||
20 | use StrategyAwareTrait; |
||
21 | |||
22 | /** |
||
23 | * Dispatch the current route |
||
24 | * |
||
25 | * @param \Psr\Http\Message\ServerRequestInterface $request |
||
26 | * |
||
27 | * @return \Psr\Http\Message\ResponseInterface |
||
28 | */ |
||
29 | 32 | public function dispatchRequest(ServerRequestInterface $request) : ResponseInterface |
|
51 | |||
52 | /** |
||
53 | * Ensure handler is a Route, honoring the contract of dispatchRequest. |
||
54 | * |
||
55 | * @param Route|mixed $matchingHandler |
||
56 | * @param string $httpMethod |
||
57 | * @param string $uri |
||
58 | * |
||
59 | * @return Route |
||
60 | * |
||
61 | */ |
||
62 | 16 | private function ensureHandlerIsRoute($matchingHandler, $httpMethod, $uri) : Route |
|
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | 32 | public function handle(ServerRequestInterface $request) : ResponseInterface |
|
83 | |||
84 | /** |
||
85 | * Set up middleware for a found route |
||
86 | * |
||
87 | * @param \League\Route\Route $route |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | 16 | protected function setFoundMiddleware(Route $route) : void |
|
110 | |||
111 | /** |
||
112 | * Set up middleware for a not found route |
||
113 | * |
||
114 | * @return void |
||
115 | */ |
||
116 | 12 | protected function setNotFoundDecoratorMiddleware() : void |
|
121 | |||
122 | /** |
||
123 | * Set up middleware for a not allowed route |
||
124 | * |
||
125 | * @param array $allowed |
||
126 | * |
||
127 | * @return void |
||
128 | */ |
||
129 | 4 | protected function setMethodNotAllowedDecoratorMiddleware(array $allowed) : void |
|
137 | } |
||
138 |