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

Application::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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