LoadConfiguration::bootstrap()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 18
rs 9.9666
ccs 9
cts 9
cp 1
cc 2
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Laravel Zero.
7
 *
8
 * (c) Nuno Maduro <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace LaravelZero\Framework\Bootstrap;
15
16
use Illuminate\Console\Application as Artisan;
17
use LaravelZero\Framework\Application;
18
use LaravelZero\Framework\Contracts\BoostrapperContract;
19
20
/**
21
 * @internal
22
 */
23
final class LoadConfiguration implements BoostrapperContract
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28 39
    public function bootstrap(Application $app): void
29
    {
30 39
        $app->make(BaseLoadConfiguration::class)
31 39
            ->bootstrap($app);
32
33 39
        $app->detectEnvironment(
34
            function () use ($app) {
35 39
                return $app['config']->get('app.production', true) ? 'production' : 'development';
36 39
            }
37
        );
38
39
        /*
40
         * When artisan starts, sets the application name and the application version.
41
         */
42 39
        Artisan::starting(
43
            function ($artisan) use ($app) {
44 39
                $artisan->setName($app['config']->get('app.name', 'Laravel Zero'));
45 39
                $artisan->setVersion($app->version());
46 39
            }
47
        );
48 39
    }
49
}
50