-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
38 lines (31 loc) · 847 Bytes
/
index.php
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
<?php
define('DS', DIRECTORY_SEPARATOR);
define('ROOT_PATH', dirname(__FILE__));
require_once ROOT_PATH . '/vendor/autoload.php';
set_error_handler(
function ($errorCode, $errorMessage, $errorFile, $errorLine) {
throw new \ErrorException($errorMessage, $errorCode, 1, $errorFile, $errorLine);
}
);
switch (php_sapi_name()) {
case 'cli':
$app = new Shirou\Cli();
set_exception_handler(
function ($e) use ($app) {
print($e);
return true;
}
);
break;
default:
$app = new Shirou\App();
set_exception_handler(
function ($e) use ($app) {
$app->getDI()->get('response')->sendErrorMessage($e);
return true;
}
);
break;
}
$app->init();
$app->run();