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(){ |
||
57 | |||
58 | public function run() { |
||
61 | /** |
||
62 | * 初始化容器 |
||
63 | */ |
||
64 | private function initContainer() { |
||
73 | |||
74 | /** |
||
75 | * Get the base path for the application. |
||
76 | * |
||
77 | * @param string|null $path |
||
78 | * @return string |
||
79 | */ |
||
80 | 3 | public function basePath($path = null) |
|
94 | /** |
||
95 | * 判断是否是cli模式 |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | public function runningInConsole() |
||
103 | /** |
||
104 | * 加载一个配置文件 |
||
105 | * |
||
106 | * @param string $name |
||
107 | * @return void |
||
108 | */ |
||
109 | public function configure($name) |
||
121 | |||
122 | |||
123 | /** |
||
124 | * 获取配置文件的路径。 |
||
125 | * |
||
126 | * 如果没有给定配置文件的名字,则返回目录。 |
||
127 | * |
||
128 | * 如果应用目录下有相应配置文件则优先返回。 |
||
129 | * |
||
130 | * @param string|null $name |
||
131 | * @return string |
||
132 | */ |
||
133 | public function getConfigurationPath($name = null) |
||
152 | } |
If you suppress an error, we recommend checking for the error condition explicitly: