1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of Laravel Zero. |
5
|
|
|
* |
6
|
|
|
* (c) Nuno Maduro <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace LaravelZero\Framework\Bootstrap; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Finder\Finder; |
15
|
|
|
use Illuminate\Console\Application as Artisan; |
16
|
|
|
use Illuminate\Contracts\Foundation\Application; |
17
|
|
|
use Illuminate\Foundation\Bootstrap\LoadConfiguration as BaseLoadConfiguration; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* This is the Laravel Zero Framework Bootstrap Load Configuration implementation. |
21
|
|
|
*/ |
22
|
|
|
class LoadConfiguration extends BaseLoadConfiguration |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Bootstrap configurations. |
26
|
|
|
* |
27
|
|
|
* @param \Illuminate\Contracts\Foundation\Application $app |
28
|
|
|
*/ |
29
|
21 |
|
public function bootstrap(Application $app): void |
30
|
|
|
{ |
31
|
21 |
|
parent::bootstrap($app); |
32
|
|
|
|
33
|
|
|
/* |
34
|
|
|
* When artisan starts, sets the application name |
35
|
|
|
* and the application version. |
36
|
|
|
*/ |
37
|
21 |
|
Artisan::starting( |
38
|
21 |
|
function ($artisan) use ($app) { |
39
|
21 |
|
$artisan->setName($app['config']->get('app.name', 'Laravel Zero')); |
40
|
21 |
|
$artisan->setVersion($app->version()); |
41
|
21 |
|
} |
42
|
|
|
); |
43
|
21 |
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Get all of the configuration files for the application. |
47
|
|
|
* |
48
|
|
|
* @param \Illuminate\Contracts\Foundation\Application $app |
49
|
|
|
* |
50
|
|
|
* @return array |
51
|
|
|
*/ |
52
|
21 |
|
protected function getConfigurationFiles(Application $app): array |
53
|
|
|
{ |
54
|
21 |
|
$files = []; |
55
|
|
|
|
56
|
21 |
|
$configPath = $app->configPath(); |
57
|
|
|
|
58
|
21 |
|
$configFiles = Finder::create() |
59
|
21 |
|
->files() |
60
|
21 |
|
->name('*.php') |
61
|
21 |
|
->in($configPath); |
62
|
|
|
|
63
|
21 |
|
foreach ($configFiles as $file) { |
64
|
21 |
|
$directory = $this->getNestedDirectory($file, $configPath); |
65
|
21 |
|
$files[$directory . basename($file->getPathName(), '.php')] = $file->getPathName(); |
66
|
|
|
} |
67
|
|
|
|
68
|
21 |
|
ksort($files, SORT_NATURAL); |
69
|
|
|
|
70
|
21 |
|
return $files; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|