Application   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 7
dl 0
loc 40
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A run() 0 4 1
A boot() 0 9 2
A getSlim() 0 4 1
A getSaver() 0 4 1
1
<?php
2
3
namespace XHGui;
4
5
use Pimple\Container;
6
use Slim\Slim as App;
7
use XHGui\Saver\SaverInterface;
8
9
class Application extends Container
10
{
11
    /** @var bool */
12
    private $booted = false;
13
14
    public function __construct()
15
    {
16
        parent::__construct();
17
        $this->register(new ServiceProvider\ServiceProvider());
18
        $this->register(new ServiceProvider\ConfigProvider());
19
        $this->register(new ServiceProvider\PdoStorageProvider());
20
        $this->register(new ServiceProvider\MongoStorageProvider());
21
        $this->register(new ServiceProvider\SlimProvider());
22
    }
23
24
    public function run(): void
25
    {
26
        $this->boot()->getSlim()->run();
27
    }
28
29
    public function boot(): self
30
    {
31
        if (!$this->booted) {
32
            $this->register(new ServiceProvider\RouteProvider());
33
            $this->booted = true;
34
        }
35
36
        return $this;
37
    }
38
39
    public function getSlim(): App
40
    {
41
        return $this['app'];
42
    }
43
44
    public function getSaver(): SaverInterface
45
    {
46
        return $this['saver'];
47
    }
48
}
49