1 | <?php namespace Limoncello\Core\Application; |
||
40 | abstract class Application implements ApplicationInterface |
||
41 | { |
||
42 | /** Method name for default request factory. */ |
||
43 | const FACTORY_METHOD = 'defaultRequestFactory'; |
||
44 | |||
45 | /** |
||
46 | * @var SapiInterface|null |
||
47 | */ |
||
48 | private $sapi; |
||
49 | |||
50 | /** |
||
51 | * @var RouterInterface |
||
52 | */ |
||
53 | private $router; |
||
54 | |||
55 | /** |
||
56 | * @return ContainerInterface |
||
57 | */ |
||
58 | abstract protected function createContainer(); |
||
59 | |||
60 | /** |
||
61 | * @return array |
||
62 | */ |
||
63 | abstract protected function getRoutesData(); |
||
64 | |||
65 | /** |
||
66 | * @return callable[] |
||
67 | */ |
||
68 | abstract protected function getGlobalMiddleware(); |
||
69 | |||
70 | /** |
||
71 | * @param SapiInterface $sapi |
||
72 | * @param ContainerInterface $container |
||
73 | * |
||
74 | * @return void |
||
75 | */ |
||
76 | abstract protected function setUpExceptionHandler(SapiInterface $sapi, ContainerInterface $container); |
||
77 | |||
78 | /** |
||
79 | * @inheritdoc |
||
80 | */ |
||
81 | 5 | public function setSapi(SapiInterface $sapi) |
|
87 | |||
88 | /** |
||
89 | * @inheritdoc |
||
90 | */ |
||
91 | 6 | public function run() |
|
141 | |||
142 | /** |
||
143 | * @return callable |
||
|
|||
144 | */ |
||
145 | 5 | public static function getDefaultRequestFactory() |
|
149 | |||
150 | /** |
||
151 | * @param SapiInterface $sapi |
||
152 | * |
||
153 | * @return ServerRequestInterface |
||
154 | */ |
||
155 | 3 | public static function defaultRequestFactory(SapiInterface $sapi) |
|
169 | |||
170 | /** |
||
171 | * @param Closure $handler |
||
172 | * @param RequestInterface|null $request |
||
173 | * |
||
174 | * @return ResponseInterface |
||
175 | */ |
||
176 | 5 | protected function handleRequest(Closure $handler, RequestInterface $request = null) |
|
183 | |||
184 | /** |
||
185 | * @param int $status |
||
186 | * @param array $headers |
||
187 | * |
||
188 | * @return ResponseInterface |
||
189 | */ |
||
190 | 2 | protected function createEmptyResponse($status = 204, array $headers = []) |
|
196 | |||
197 | /** |
||
198 | * @return RouterInterface |
||
199 | */ |
||
200 | 5 | protected function getRouter() |
|
209 | |||
210 | /** |
||
211 | * @return array |
||
212 | */ |
||
213 | 5 | protected function getRouterConfig() |
|
217 | |||
218 | /** |
||
219 | * @param ContainerInterface $container |
||
220 | * @param callable[] $configurators |
||
221 | * |
||
222 | * @return void |
||
223 | */ |
||
224 | 2 | protected function configureUserContainer(ContainerInterface $container, array $configurators) |
|
230 | |||
231 | /** |
||
232 | * @param Closure $handler |
||
233 | * @param ContainerInterface $userContainer |
||
234 | * @param array|null $globalMiddleware |
||
235 | * @param array|null $routeMiddleware |
||
236 | * |
||
237 | * @return Closure |
||
238 | */ |
||
239 | 5 | protected function createMiddlewareChain( |
|
250 | |||
251 | /** |
||
252 | * @param callable $handler |
||
253 | * @param array $handlerParams |
||
254 | * @param ContainerInterface $container |
||
255 | * @param ServerRequestInterface|null $request |
||
256 | * |
||
257 | * @return ResponseInterface |
||
258 | */ |
||
259 | 3 | protected function callControllerHandler( |
|
267 | |||
268 | /** |
||
269 | * @return RouterInterface |
||
270 | */ |
||
271 | 5 | private function createRouter() |
|
281 | |||
282 | /** |
||
283 | * @param SapiInterface $sapi |
||
284 | * @param ContainerInterface $userContainer |
||
285 | * @param callable $requestFactory |
||
286 | * |
||
287 | * @return ServerRequestInterface |
||
288 | */ |
||
289 | 4 | private function createRequest( |
|
298 | |||
299 | /** |
||
300 | * @param callable $handler |
||
301 | * @param array $handlerParams |
||
302 | * @param ContainerInterface $container |
||
303 | * |
||
304 | * @return Closure |
||
305 | */ |
||
306 | 3 | private function createOrdinaryTerminalHandler( |
|
315 | |||
316 | /** |
||
317 | * @param array $allowedMethods |
||
318 | * |
||
319 | * @return Closure |
||
320 | */ |
||
321 | 1 | private function createMethodNotAllowedTerminalHandler(array $allowedMethods) |
|
328 | |||
329 | /** |
||
330 | * @return Closure |
||
331 | */ |
||
332 | 1 | private function createNotFoundTerminalHandler() |
|
339 | |||
340 | /** |
||
341 | * @param Closure $handler |
||
342 | * @param ContainerInterface $userContainer |
||
343 | * @param array|null $middleware |
||
344 | * |
||
345 | * @return Closure |
||
346 | */ |
||
347 | 5 | private function createMiddlewareChainImpl( |
|
359 | |||
360 | /** |
||
361 | * @param Closure $next |
||
362 | * @param callable $middleware |
||
363 | * @param ContainerInterface $userContainer |
||
364 | * |
||
365 | * @return Closure |
||
366 | */ |
||
367 | private function createMiddlewareChainLink(Closure $next, callable $middleware, ContainerInterface $userContainer) |
||
373 | } |
||
374 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.