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() |
|
133 | |||
134 | /** |
||
135 | * @return callable |
||
|
|||
136 | */ |
||
137 | 5 | public static function getDefaultRequestFactory() |
|
141 | |||
142 | /** |
||
143 | * @param SapiInterface $sapi |
||
144 | * |
||
145 | * @return ServerRequestInterface |
||
146 | */ |
||
147 | 3 | public static function defaultRequestFactory(SapiInterface $sapi) |
|
161 | |||
162 | /** |
||
163 | * @param Closure $handler |
||
164 | * @param RequestInterface|null $request |
||
165 | * |
||
166 | * @return ResponseInterface |
||
167 | */ |
||
168 | 5 | protected function handleRequest(Closure $handler, RequestInterface $request = null) |
|
175 | |||
176 | /** |
||
177 | * @param int $status |
||
178 | * @param array $headers |
||
179 | * |
||
180 | * @return ResponseInterface |
||
181 | */ |
||
182 | 2 | protected function createEmptyResponse($status = 204, array $headers = []) |
|
188 | |||
189 | /** |
||
190 | * @return RouterInterface |
||
191 | */ |
||
192 | 5 | protected function getRouter() |
|
201 | |||
202 | /** |
||
203 | * @return array |
||
204 | */ |
||
205 | 5 | protected function getRouterConfig() |
|
209 | |||
210 | /** |
||
211 | * @param ContainerInterface $container |
||
212 | * @param callable[] $configurators |
||
213 | * |
||
214 | * @return void |
||
215 | */ |
||
216 | 2 | protected function configureUserContainer(ContainerInterface $container, array $configurators) |
|
222 | |||
223 | /** |
||
224 | * @param Closure $handler |
||
225 | * @param ContainerInterface $userContainer |
||
226 | * @param array|null $globalMiddleware |
||
227 | * @param array|null $routeMiddleware |
||
228 | * |
||
229 | * @return Closure |
||
230 | */ |
||
231 | 5 | protected function createMiddlewareChain( |
|
242 | |||
243 | /** |
||
244 | * @return RouterInterface |
||
245 | */ |
||
246 | 5 | private function createRouter() |
|
256 | |||
257 | /** |
||
258 | * @param SapiInterface $sapi |
||
259 | * @param ContainerInterface $userContainer |
||
260 | * @param callable|null $requestFactory |
||
261 | * |
||
262 | * @return ServerRequestInterface |
||
263 | */ |
||
264 | 4 | private function createRequest( |
|
277 | |||
278 | /** |
||
279 | * @param callable $handler |
||
280 | * @param array $handlerParams |
||
281 | * @param ContainerInterface $container |
||
282 | * |
||
283 | * @return Closure |
||
284 | */ |
||
285 | 3 | private function createOrdinaryTerminalHandler( |
|
294 | |||
295 | /** |
||
296 | * @param array $allowedMethods |
||
297 | * |
||
298 | * @return Closure |
||
299 | */ |
||
300 | 1 | private function createMethodNotAllowedTerminalHandler(array $allowedMethods) |
|
307 | |||
308 | /** |
||
309 | * @return Closure |
||
310 | */ |
||
311 | 1 | private function createNotFoundTerminalHandler() |
|
318 | |||
319 | /** |
||
320 | * @param Closure $handler |
||
321 | * @param ContainerInterface $userContainer |
||
322 | * @param array|null $middleware |
||
323 | * |
||
324 | * @return Closure |
||
325 | */ |
||
326 | 5 | private function createMiddlewareChainImpl( |
|
338 | |||
339 | /** |
||
340 | * @param Closure $next |
||
341 | * @param callable $middleware |
||
342 | * @param ContainerInterface $userContainer |
||
343 | * |
||
344 | * @return Closure |
||
345 | */ |
||
346 | private function createMiddlewareChainLink(Closure $next, callable $middleware, ContainerInterface $userContainer) |
||
352 | } |
||
353 |
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.