@@ -19,35 +19,35 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * Website document root |
21 | 21 | */ |
22 | -define('DOCROOT', __DIR__.DIRECTORY_SEPARATOR); |
|
22 | +define('DOCROOT', __DIR__ . DIRECTORY_SEPARATOR); |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Path to the application directory. |
26 | 26 | */ |
27 | -define('APPPATH', realpath(__DIR__.'/../fuel/app/').DIRECTORY_SEPARATOR); |
|
27 | +define('APPPATH', realpath(__DIR__ . '/../fuel/app/') . DIRECTORY_SEPARATOR); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Path to the default packages directory. |
31 | 31 | */ |
32 | -define('PKGPATH', realpath(__DIR__.'/../fuel/packages/').DIRECTORY_SEPARATOR); |
|
32 | +define('PKGPATH', realpath(__DIR__ . '/../fuel/packages/') . DIRECTORY_SEPARATOR); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * The path to the framework core. |
36 | 36 | */ |
37 | -define('COREPATH', realpath(__DIR__.'/../fuel/core/').DIRECTORY_SEPARATOR); |
|
37 | +define('COREPATH', realpath(__DIR__ . '/../fuel/core/') . DIRECTORY_SEPARATOR); |
|
38 | 38 | |
39 | 39 | // Get the start time and memory for use later |
40 | 40 | defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true)); |
41 | 41 | defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage()); |
42 | 42 | |
43 | 43 | // Load in the Fuel autoloader |
44 | -if ( ! file_exists(COREPATH.'classes'.DIRECTORY_SEPARATOR.'autoloader.php')) |
|
44 | +if (!file_exists(COREPATH . 'classes' . DIRECTORY_SEPARATOR . 'autoloader.php')) |
|
45 | 45 | { |
46 | 46 | die('No composer autoloader found. Please run composer to install the FuelPHP framework dependencies first!'); |
47 | 47 | } |
48 | 48 | |
49 | 49 | // Activate the framework class autoloader |
50 | -require COREPATH.'classes'.DIRECTORY_SEPARATOR.'autoloader.php'; |
|
50 | +require COREPATH . 'classes' . DIRECTORY_SEPARATOR . 'autoloader.php'; |
|
51 | 51 | class_alias('Fuel\\Core\\Autoloader', 'Autoloader'); |
52 | 52 | |
53 | 53 | // Exception route processing closure |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | { |
56 | 56 | Request::reset_request(true); |
57 | 57 | |
58 | - $route = array_key_exists($request, Router::$routes) ? Router::$routes[$request]->translation : Config::get('routes.'.$request); |
|
58 | + $route = array_key_exists($request, Router::$routes) ? Router::$routes[$request]->translation : Config::get('routes.' . $request); |
|
59 | 59 | |
60 | 60 | if ($route instanceof Closure) |
61 | 61 | { |
62 | 62 | $response = $route(); |
63 | 63 | |
64 | - if( ! $response instanceof Response) |
|
64 | + if (!$response instanceof Response) |
|
65 | 65 | { |
66 | 66 | $response = Response::forge($response); |
67 | 67 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | try |
91 | 91 | { |
92 | 92 | // Boot the app... |
93 | - require APPPATH.'bootstrap.php'; |
|
93 | + require APPPATH . 'bootstrap.php'; |
|
94 | 94 | |
95 | 95 | // ... and execute the main request |
96 | 96 | $response = $routerequest(); |
@@ -65,20 +65,16 @@ discard block |
||
65 | 65 | { |
66 | 66 | $response = Response::forge($response); |
67 | 67 | } |
68 | - } |
|
69 | - elseif ($e === false) |
|
68 | + } elseif ($e === false) |
|
70 | 69 | { |
71 | 70 | $response = Request::forge()->execute()->response(); |
72 | - } |
|
73 | - elseif ($route) |
|
71 | + } elseif ($route) |
|
74 | 72 | { |
75 | 73 | $response = Request::forge($route, false)->execute(array($e))->response(); |
76 | - } |
|
77 | - elseif ($request) |
|
74 | + } elseif ($request) |
|
78 | 75 | { |
79 | 76 | $response = Request::forge($request)->execute(array($e))->response(); |
80 | - } |
|
81 | - else |
|
77 | + } else |
|
82 | 78 | { |
83 | 79 | throw $e; |
84 | 80 | } |
@@ -94,20 +90,16 @@ discard block |
||
94 | 90 | |
95 | 91 | // ... and execute the main request |
96 | 92 | $response = $routerequest(); |
97 | -} |
|
98 | -catch (HttpBadRequestException $e) |
|
93 | +} catch (HttpBadRequestException $e) |
|
99 | 94 | { |
100 | 95 | $response = $routerequest('_400_', $e); |
101 | -} |
|
102 | -catch (HttpNoAccessException $e) |
|
96 | +} catch (HttpNoAccessException $e) |
|
103 | 97 | { |
104 | 98 | $response = $routerequest('_403_', $e); |
105 | -} |
|
106 | -catch (HttpNotFoundException $e) |
|
99 | +} catch (HttpNotFoundException $e) |
|
107 | 100 | { |
108 | 101 | $response = $routerequest('_404_', $e); |
109 | -} |
|
110 | -catch (HttpServerErrorException $e) |
|
102 | +} catch (HttpServerErrorException $e) |
|
111 | 103 | { |
112 | 104 | $response = $routerequest('_500_', $e); |
113 | 105 | } |