1 | <?php |
||
15 | class App extends Container { |
||
16 | /** |
||
17 | * 已经加载的config文件 |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $loadedConfigurations = []; |
||
22 | |||
23 | /** |
||
24 | * 应用的根目录. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $basePath; |
||
29 | public function __construct($basePath) { |
||
38 | |||
39 | private function initEnv(){ |
||
62 | |||
63 | public function run() { |
||
66 | /** |
||
67 | * 初始化容器 |
||
68 | */ |
||
69 | private function initContainer() { |
||
78 | |||
79 | /** |
||
80 | * Get the base path for the application. |
||
81 | * |
||
82 | * @param string|null $path |
||
83 | * @return string |
||
84 | */ |
||
85 | 3 | public function basePath($path = null) |
|
99 | /** |
||
100 | * 判断是否是cli模式 |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | public function runningInConsole() |
||
108 | /** |
||
109 | * 加载一个配置文件 |
||
110 | * |
||
111 | * @param string $name |
||
112 | * @return void |
||
113 | */ |
||
114 | public function configure($name) |
||
126 | |||
127 | |||
128 | /** |
||
129 | * 获取配置文件的路径。 |
||
130 | * |
||
131 | * 如果没有给定配置文件的名字,则返回目录。 |
||
132 | * |
||
133 | * 如果应用目录下有相应配置文件则优先返回。 |
||
134 | * |
||
135 | * @param string|null $name |
||
136 | * @return string |
||
137 | */ |
||
138 | public function getConfigurationPath($name = null) |
||
157 | } |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.