Completed
Push — master ( c423df...c8e3b5 )
by Park Jong-Hun
03:08
created

Bootstrap   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 44
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 15 1
A getSiteConfig() 0 4 1
A getErrorReporterConfig() 0 4 1
A getDbConfig() 0 4 1
A getViewEngineConfig() 0 4 1
A getRouterConfig() 0 4 1
1
<?php
2
3
namespace App;
4
5
use Core\Application;
6
use Prob\Rewrite\Request;
7
8
class Bootstrap
9
{
10
11
    public static function boot()
12
    {
13
        $application = Application::getInstance();
14
15
        $application->setSiteConfig(self::getSiteConfig());
16
        $application->setErrorReporterConfig(self::getErrorReporterConfig());
17
        $application->setDbConfig(self::getDbConfig());
18
        $application->setViewEngineConfig(self::getViewEngineConfig());
19
20
        $application->setDisplayError(self::getSiteConfig()['displayErrors']);
21
        $application->registerErrorReporters();
22
23
        $application->setRouterConfig(self::getRouterConfig());
24
        $application->dispatcher(new Request());
25
    }
26
27
    public static function getSiteConfig()
28
    {
29
        return require '../config/site.php';
30
    }
31
32
    public static function getErrorReporterConfig()
33
    {
34
        return require '../config/errorReporter.php';
35
    }
36
37
    public static function getDbConfig()
38
    {
39
        return require '../config/db.php';
40
    }
41
42
    public static function getViewEngineConfig()
43
    {
44
        return require '../config/viewEngine.php';
45
    }
46
47
    public static function getRouterConfig()
48
    {
49
        return require '../config/router.php';
50
    }
51
}
52