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

ApplicationBootstrap::getDbConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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