1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * This file is part of the alphaz Framework. |
||||
5 | * |
||||
6 | * @author Muhammad Umer Farooq (Malik) <[email protected]> |
||||
7 | * |
||||
8 | * @link https://github.com/alphazframework/framework |
||||
9 | * |
||||
10 | * For the full copyright and license information, please view the LICENSE |
||||
11 | * file that was distributed with this source code. |
||||
12 | * @since 1.0.0 |
||||
13 | * |
||||
14 | * @license MIT |
||||
15 | */ |
||||
16 | |||||
17 | namespace alphaz; |
||||
18 | |||||
19 | use alphaz\Common\AliasLoader; |
||||
20 | use alphaz\Common\TimeZone; |
||||
21 | use alphaz\http\Request; |
||||
22 | use alphaz\Router\App; |
||||
23 | |||||
24 | class Bootstrap |
||||
25 | { |
||||
26 | /** |
||||
27 | * Set Default configuration. |
||||
28 | * |
||||
29 | * @since 1.0.0 |
||||
30 | * |
||||
31 | * @return void |
||||
32 | */ |
||||
33 | public function configure() |
||||
34 | { |
||||
35 | TimeZone::seteDefaultTz(__config('app.time_zone')); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
36 | } |
||||
37 | |||||
38 | /** |
||||
39 | * Register the class aliases. |
||||
40 | * |
||||
41 | * @since 1.0.0 |
||||
42 | * |
||||
43 | * @return void |
||||
44 | */ |
||||
45 | protected function registerClassAliases() |
||||
46 | { |
||||
47 | $aliases = __config('class_aliases'); |
||||
48 | if (!empty($aliases)) { |
||||
49 | $aliasLoader = new AliasLoader($aliases); |
||||
50 | spl_autoload_register([$aliasLoader, 'load']); |
||||
51 | } |
||||
52 | } |
||||
53 | |||||
54 | /** |
||||
55 | * Register the App. |
||||
56 | * |
||||
57 | * @since 1.0.0 |
||||
58 | * |
||||
59 | * @return void |
||||
60 | */ |
||||
61 | public function registerApp() |
||||
62 | { |
||||
63 | (new App())->run()->dispatch(new Request()); |
||||
64 | } |
||||
65 | |||||
66 | /** |
||||
67 | * Load the boostrap file. |
||||
68 | * |
||||
69 | * @since 1.0.0 |
||||
70 | * |
||||
71 | * @return void |
||||
72 | */ |
||||
73 | public function bootstrap() |
||||
74 | { |
||||
75 | $file = route('root').'/bootstrap.php'; |
||||
0 ignored issues
–
show
Are you sure
route('root') of type array can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
76 | if (file_exists($file)) { |
||||
77 | include_once $file; |
||||
78 | } |
||||
79 | } |
||||
80 | |||||
81 | /** |
||||
82 | * Boot the application. |
||||
83 | * |
||||
84 | * @since 1.0.0 |
||||
85 | * |
||||
86 | * @return void |
||||
87 | */ |
||||
88 | public function boot() |
||||
89 | { |
||||
90 | //Set default configuration |
||||
91 | $this->configure(); |
||||
92 | //Loaded class aliases |
||||
93 | $this->registerClassAliases(); |
||||
94 | //Load the application bootstrap file |
||||
95 | $this->bootstrap(); |
||||
96 | //register the app |
||||
97 | $this->registerApp(); |
||||
98 | } |
||||
99 | } |
||||
100 |