Completed
Push — master ( b31514...603a9f )
by Changwan
06:16
created

Application   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 92.86%

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 38
ccs 13
cts 14
cp 0.9286
rs 10
wmc 5
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 5 1
A boot() 0 11 3
1
<?php
2
namespace Wandu\Foundation;
3
4
use Wandu\DI\Container;
5
use Wandu\Foundation\Contracts\Bootstrap;
6
7
class Application extends Container
8
{
9
    const NAME = "Wandu";
10
    const VERSION = "4.0-dev";
11
12
    /** @var \Wandu\Foundation\Contracts\Bootstrap */
13
    protected $bootstrapper;
14
    
15 6
    public function __construct(Bootstrap $bootstrapper)
16
    {
17 6
        parent::__construct();
18 6
        $this->bootstrapper = $bootstrapper;
19 6
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 6
    public function boot()
25
    {
26 6
        if (!$this->isBooted) {
27 6
            foreach ($this->bootstrapper->providers() as $provider) {
28
                $this->register($provider);
29
            }
30 6
            $this->bootstrapper->boot($this);
31 6
            parent::boot();
32
        }
33 6
        return $this;
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39 1
    public function execute()
40
    {
41 1
        $this->boot();
42 1
        return $this->bootstrapper->execute($this);
43
    }
44
}
45