1 | <?php |
||
30 | class Application extends Container |
||
31 | { |
||
32 | const VERSION = 'v3.2.0'; |
||
33 | |||
34 | /** |
||
35 | * @var Application |
||
36 | */ |
||
37 | public static $app; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $path; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $name; |
||
48 | |||
49 | /** |
||
50 | * @var bool |
||
51 | */ |
||
52 | protected $booted = false; |
||
53 | |||
54 | /** |
||
55 | * AppKernel constructor. |
||
56 | * |
||
57 | * @param $path |
||
58 | */ |
||
59 | 31 | public function __construct($path) |
|
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | 31 | public function getName() |
|
77 | |||
78 | /** |
||
79 | * @return bool |
||
80 | */ |
||
81 | 1 | public function isBooted() |
|
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | 31 | public function getPath() |
|
93 | |||
94 | 31 | public function bootstrap() |
|
110 | |||
111 | 31 | protected function registerExceptionHandler() |
|
112 | { |
||
113 | 31 | error_reporting(-1); |
|
114 | |||
115 | 31 | set_exception_handler([$this, 'handleException']); |
|
116 | |||
117 | 31 | set_error_handler(function ($level, $message, $file = '', $line = 0) { |
|
118 | throw new ErrorException($message, 0, $level, $file, $line); |
||
119 | 31 | }); |
|
120 | 31 | } |
|
121 | |||
122 | /** |
||
123 | * @param ServiceProviderInterface[] $services |
||
124 | */ |
||
125 | 31 | protected function registerServicesProviders(array $services) |
|
132 | |||
133 | /** |
||
134 | * @param ServerRequestInterface $request |
||
135 | * |
||
136 | * @return Response |
||
137 | */ |
||
138 | 8 | public function handleRequest(ServerRequestInterface $request) |
|
159 | |||
160 | /** |
||
161 | * @param Response $response |
||
162 | */ |
||
163 | 1 | public function handleResponse(Response $response) |
|
167 | |||
168 | /** |
||
169 | * @param $e |
||
170 | * |
||
171 | * @return Response |
||
172 | */ |
||
173 | 3 | public function handleException($e) |
|
200 | |||
201 | /** |
||
202 | * @return int |
||
203 | */ |
||
204 | public function run() |
||
214 | |||
215 | /** |
||
216 | * @param ServerRequestInterface $request |
||
217 | * @param ResponseInterface $response |
||
218 | * |
||
219 | * @return int |
||
220 | */ |
||
221 | 2 | public function shutdown(ServerRequestInterface $request, ResponseInterface $response) |
|
230 | } |
||
231 |