Completed
Push — master ( c458f8...eeebc2 )
by Matze
06:56
created

Core::boot()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 3.0327

Importance

Changes 12
Bugs 0 Features 4
Metric Value
c 12
b 0
f 4
dl 0
loc 22
ccs 11
cts 13
cp 0.8462
rs 9.2
cc 3
eloc 14
nc 3
nop 0
crap 3.0327
1
<?php
2
3
namespace BrainExe\Core;
4
5
use BrainExe\Core\DependencyInjection\Rebuild;
6
use Symfony\Component\DependencyInjection\Container;
7
8
/**
9
 * @api
10
 */
11
class Core
12
{
13
14
    /**
15
     * @return Container
16
     */
17 2
    public function boot() : Container
18
    {
19 2
        chdir(ROOT);
20 2
        umask(0); // todo try to remove
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
21
22 2
        $fileName = ROOT . 'cache/dic.php';
23
        /** @var Container $dic */
24 2
        if (is_file($fileName)) {
25 2
            $className = file_get_contents(ROOT . 'cache/dic.txt');
26 2
            if (!class_exists($className, false)) {
27 1
                include $fileName;
28
            }
29 2
            $dic = new $className();
30
        } else {
31
            $rebuild = new Rebuild();
32
            $dic = $rebuild->rebuildDIC(true);
33
        }
34
35 2
        $dic->get('monolog.ErrorHandler');
36
37 2
        return $dic;
38
    }
39
}
40