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() |
|
134 | |||
135 | /** |
||
136 | * @return callable |
||
|
|||
137 | */ |
||
138 | 5 | public static function getDefaultRequestFactory() |
|
142 | |||
143 | /** |
||
144 | * @param SapiInterface $sapi |
||
145 | * |
||
146 | * @return ServerRequestInterface |
||
147 | */ |
||
148 | 3 | public static function defaultRequestFactory(SapiInterface $sapi) |
|
162 | |||
163 | /** |
||
164 | * @param int $status |
||
165 | * @param array $headers |
||
166 | * |
||
167 | * @return ResponseInterface |
||
168 | */ |
||
169 | 2 | protected function createEmptyResponse($status = 204, array $headers = []) |
|
175 | |||
176 | /** |
||
177 | * @return RouterInterface |
||
178 | */ |
||
179 | 5 | protected function getRouter() |
|
188 | |||
189 | /** |
||
190 | * @return array |
||
191 | */ |
||
192 | 5 | protected function getCoreConfig() |
|
199 | |||
200 | /** |
||
201 | * @return RouterInterface |
||
202 | */ |
||
203 | 5 | private function createRouter() |
|
222 | |||
223 | /** |
||
224 | * @param ContainerInterface $container |
||
225 | * @param callable[] $configurators |
||
226 | * |
||
227 | * @return void |
||
228 | */ |
||
229 | 2 | private function configureUserContainer(ContainerInterface $container, array $configurators) |
|
235 | |||
236 | /** |
||
237 | * @param SapiInterface $sapi |
||
238 | * @param ContainerInterface $userContainer |
||
239 | * @param callable|null $requestFactory |
||
240 | * |
||
241 | * @return ServerRequestInterface |
||
242 | */ |
||
243 | 4 | private function createRequest( |
|
256 | |||
257 | /** |
||
258 | * @param callable $handler |
||
259 | * @param array $handlerParams |
||
260 | * @param ContainerInterface $container |
||
261 | * |
||
262 | * @return Closure |
||
263 | */ |
||
264 | 3 | private function createOrdinaryTerminalHandler( |
|
273 | |||
274 | /** |
||
275 | * @param array $allowedMethods |
||
276 | * |
||
277 | * @return Closure |
||
278 | */ |
||
279 | 1 | private function createMethodNotAllowedTerminalHandler(array $allowedMethods) |
|
286 | |||
287 | /** |
||
288 | * @return Closure |
||
289 | */ |
||
290 | 1 | private function createNotFoundTerminalHandler() |
|
297 | |||
298 | /** |
||
299 | * @param Closure $handler |
||
300 | * @param ContainerInterface $userContainer |
||
301 | * @param array|null $globalMiddleware |
||
302 | * @param array|null $routeMiddleware |
||
303 | * |
||
304 | * @return Closure |
||
305 | */ |
||
306 | 5 | private function createMiddlewareChain( |
|
317 | |||
318 | /** |
||
319 | * @param Closure $handler |
||
320 | * @param ContainerInterface $userContainer |
||
321 | * @param array|null $middleware |
||
322 | * |
||
323 | * @return Closure |
||
324 | */ |
||
325 | 5 | private function createMiddlewareChainImpl( |
|
336 | |||
337 | /** |
||
338 | * @param Closure $next |
||
339 | * @param callable $middleware |
||
340 | * @param ContainerInterface $userContainer |
||
341 | * |
||
342 | * @return Closure |
||
343 | */ |
||
344 | private function createMiddlewareChainLink(Closure $next, callable $middleware, ContainerInterface $userContainer) |
||
350 | |||
351 | /** |
||
352 | * @param array $config |
||
353 | * @param int|string $key |
||
354 | * @param mixed $default |
||
355 | * |
||
356 | * @return mixed |
||
357 | */ |
||
358 | 5 | private function getValue(array $config, $key, $default) |
|
364 | } |
||
365 |
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.