Completed
Push — master ( c2bacd...81a0c2 )
by Park Jong-Hun
08:02
created

ApplicationBootstrap   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 7
c 3
b 0
f 1
lcom 1
cbo 1
dl 0
loc 50
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 16 1
A getSiteConfig() 0 4 1
A getErrorReporterConfig() 0 4 1
A getViewEngineConfig() 0 4 1
A getViewResolvers() 0 4 1
A getEventListener() 0 4 1
A getRouterConfig() 0 4 1
1
<?php
2
3
namespace App\Bootstrap;
4
5
use Core\Application;
6
use Core\Bootstrap\BootstrapInterface;
7
use Core\Bootstrap\SiteConfigLoader;
8
9
class ApplicationBootstrap implements BootstrapInterface, SiteConfigLoader
10
{
11
12
    public function boot(Application $app)
13
    {
14
        $app->setSiteConfig($this->getSiteConfig());
15
        $app->setErrorReporterConfig($this->getErrorReporterConfig());
16
17
        $app->setViewEngineConfig($this->getViewEngineConfig());
18
        $app->setViewResolver($this->getViewResolvers());
19
20
        $app->setDisplayError($this->getSiteConfig()['displayErrors']);
21
        $app->registerErrorReporters();
22
23
        $app->setEventListener($this->getEventListener());
24
        $app->registerEventListener();
25
26
        $app->setRouterConfig($this->getRouterConfig());
27
    }
28
29
    public function getSiteConfig()
30
    {
31
        return require __DIR__ . '/../../config/site.php';
32
    }
33
34
    private function getErrorReporterConfig()
35
    {
36
        return require __DIR__ . '/../../config/errorReporter.php';
37
    }
38
39
    private function getViewEngineConfig()
40
    {
41
        return require __DIR__ . '/../../config/viewEngine.php';
42
    }
43
44
    private function getViewResolvers()
45
    {
46
        return require __DIR__ . '/../../config/viewResolver.php';
47
    }
48
49
    private function getEventListener()
50
    {
51
        return require __DIR__ . '/../../config/event.php';
52
    }
53
54
    private function getRouterConfig()
55
    {
56
        return require __DIR__ . '/../../config/router.php';
57
    }
58
}
59