Completed
Push — master ( 39c1d7...699dc6 )
by Changwan
06:44
created

Application   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 78.56%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 11
cts 14
cp 0.7856
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2

3 Methods

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