Completed
Push — master ( d935de...f6e733 )
by Park Jong-Hun
04:25
created

ApplicationBootstrap::getRouterConfig()   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
        $app->setDbConfig($this->getDbConfig());
17
        $app->setViewEngineConfig($this->getViewEngineConfig());
18
19
        $app->setDisplayError($this->getSiteConfig()['displayErrors']);
20
        $app->registerErrorReporters();
21
22
        $app->setEventListener($this->getEventListener());
23
        $app->registerEventListener();
24
25
        $app->setRouterConfig($this->getRouterConfig());
26
    }
27
28
    public function getSiteConfig()
29
    {
30
        return require __DIR__ . '/../../config/site.php';
31
    }
32
33
    private function getErrorReporterConfig()
34
    {
35
        return require __DIR__ . '/../../config/errorReporter.php';
36
    }
37
38
    private function getDbConfig()
39
    {
40
        return require __DIR__ . '/../../config/db.php';
41
    }
42
43
    private function getViewEngineConfig()
44
    {
45
        return require __DIR__ . '/../../config/viewEngine.php';
46
    }
47
48
    private function getEventListener()
49
    {
50
        return require __DIR__ . '/../../config/event.php';
51
    }
52
53
    private function getRouterConfig()
54
    {
55
        return require __DIR__ . '/../../config/router.php';
56
    }
57
}
58