Completed
Push — master ( 124fed...6caa0a )
by Tomáš
12s
created

DefaultKernel   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 7

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 3
cbo 7
dl 0
loc 77
ccs 0
cts 46
cp 0
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getKernelParameters() 0 6 1
A registerBundles() 0 11 1
A registerContainerConfiguration() 0 6 2
A boot() 0 10 2
A buildContainer() 0 8 1
A initializeContainer() 0 6 1
1
<?php
2
3
/*
4
 * This file is a part of Sculpin.
5
 *
6
 * (c) Dragonfly Development Inc.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Symplify\PHP7_Sculpin\HttpKernel;
13
14
use Symplify\PHP7_Sculpin\PostsBundle\SculpinPostsBundle;
15
use Symplify\PHP7_Sculpin\SculpinBundle;
16
use Symplify\PHP7_Sculpin\TwigBundle\SculpinTwigBundle;
17
use Symfony\Component\Config\Loader\LoaderInterface;
18
use Symfony\Component\HttpKernel\Kernel;
19
use Symplify\DefaultAutowire\SymplifyDefaultAutowireBundle;
20
21
final class DefaultKernel extends Kernel
22
{
23
    public function __construct()
24
    {
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function getKernelParameters()
31
    {
32
        return array_merge(parent::getKernelParameters(), [
33
            'sculpin.project_dir' => getcwd(),
34
        ]);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function registerBundles()
41
    {
42
        $bundles = [
43
            new SymplifyDefaultAutowireBundle(),
44
            new SculpinBundle(),
45
            new SculpinTwigBundle(),
46
            new SculpinPostsBundle(),
47
        ];
48
49
        return $bundles;
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function registerContainerConfiguration(LoaderInterface $loader)
56
    {
57
        if (file_exists($file = $this->rootDir.'/config/sculpin_kernel.yml')) {
58
            $loader->load($file);
59
        }
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function boot()
66
    {
67
        if (true === $this->booted) {
68
            return;
69
        }
70
71
        parent::boot();
72
73
        $this->container->compile();
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     */
79
    protected function buildContainer()
80
    {
81
        $container = $this->getContainerBuilder();
82
        $container->addObjectResource($this);
83
        $this->prepareContainer($container);
84
85
        return $container;
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91
    protected function initializeContainer()
92
    {
93
        $container = $this->buildContainer();
94
        $container->set('kernel', $this);
95
        $this->container = $container;
96
    }
97
}
98