-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKernel.php
More file actions
42 lines (34 loc) · 907 Bytes
/
Kernel.php
File metadata and controls
42 lines (34 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* 核心类,再次完成整个程序的生命周期
*/
namespace Numst;
use Numst\Kernel\Http\Kernel as httpKernel;
use Numst\Router\Router;
class Kernel implements httpKernel{
protected $app;
public function __construct(Container $app,Router $router){
$this->app = $app;
$this->router = $router;
}
public function bootstrap(){
//TODO
}
public function handle($request){
try{
$response = $this->sendRequestThrouthRouter($request);
} catch(\Exception $e) {
throw new \Exception($e);
} catch(\Throwable $e) {
throw new \Throwable($e);
}
//发布事件
//$this->app['events']->dispatch();
return $response;
}
public function terminate($request, $response){
}
public function getApplication(){
return $this->app;
}
}