Completed
Push — master ( 54ccda...232c7c )
by Changwan
04: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 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A boot() 0 11 3
A execute() 0 5 1
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 7
    public function __construct(Bootstrap $bootstrapper)
16
    {
17 7
        parent::__construct();
18 7
        $this->instance(Bootstrap::class, $this->bootstrapper = $bootstrapper);
19 7
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 7
    public function boot()
25
    {
26 7
        if (!$this->isBooted) {
27 7
            foreach ($this->bootstrapper->providers() as $provider) {
28 1
                $this->register($provider);
29
            }
30 7
            $this->bootstrapper->boot($this);
31 7
            parent::boot();
32
        }
33 7
        return $this;
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39 2
    public function execute()
40
    {
41 2
        $this->boot();
42 2
        return $this->bootstrapper->execute($this);
43
    }
44
}
45