Bootstrap   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A load() 0 11 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: polidog
5
 * Date: 2016/07/17.
6
 */
7
8
namespace Polidog\LaravelBundle;
9
10
use Illuminate\Contracts\Foundation\Application;
11
use Polidog\LaravelBundle\Exception\FallbackException;
12
13
class Bootstrap
14
{
15
    /**
16
     * @var string
17
     */
18
    private $bootstrapFile;
19
20
    /**
21
     * @var Application
22
     */
23
    private $app;
24
25
    /**
26
     * Bootstrap constructor.
27
     *
28
     * @param string $bootstrapFile
29
     */
30
    public function __construct($bootstrapFile)
31
    {
32
        $this->bootstrapFile = $bootstrapFile;
33
34
    }
35
36
    public function load()
37
    {
38
        if ($this->app === null) {
39
            if (!file_exists($this->bootstrapFile)) {
40
                throw new FallbackException('Bootstrap file not found. '.$this->bootstrapFile);
41
            }
42
            $this->app = require $this->bootstrapFile;
43
        }
44
45
        return $this->app;
46
    }
47
48
}
49