DetectEnvironment::bootstrap()   A
last analyzed

Complexity

Conditions 2
Paths 4

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 19
ccs 10
cts 10
cp 1
rs 9.4286
cc 2
eloc 9
nc 4
nop 1
crap 2
1
<?php namespace Lanin\Laravel\SetupWizard\Support\Bootstrap;
2
3
use Dotenv;
4
use Illuminate\Contracts\Foundation\Application;
5
use InvalidArgumentException;
6
7
class DetectEnvironment
8
{
9
    /**
10
     * Bootstrap the given application.
11
     *
12
     * @param  \Illuminate\Contracts\Foundation\Application $app
13
     * @return void
14
     */
15 6
    public function bootstrap(Application $app)
16
    {
17
        try
18
        {
19 6
            Dotenv::makeMutable();
20 6
            Dotenv::load($app->environmentPath(), $app->environmentFile());
0 ignored issues
show
Bug introduced by
The method environmentPath() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean environment()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
Bug introduced by
The method environmentFile() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean environment()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
21 4
            Dotenv::makeImmutable();
22 6
        } catch (InvalidArgumentException $e)
23
        {
24
            //
25
        }
26
27 6
        $app->detectEnvironment(
0 ignored issues
show
Bug introduced by
The method detectEnvironment() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean environment()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
28 6
            function ()
29
            {
30 6
                return env('APP_ENV', 'production');
31
            }
32 6
        );
33 6
    }
34
}
35