AppKernel   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 5
dl 0
loc 49
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 3
A registerBundles() 0 7 1
A registerContainerConfiguration() 0 4 1
A getCacheDir() 0 4 1
A serialize() 0 4 1
A unserialize() 0 4 1
1
<?php
2
3
namespace Happyr\AutoFallbackTranslationBundle\Tests\Functional\app;
4
5
use Happyr\AutoFallbackTranslationBundle\HappyrAutoFallbackTranslationBundle;
6
use Symfony\Component\Config\Loader\LoaderInterface;
7
use Symfony\Component\Filesystem\Filesystem;
8
use Symfony\Component\HttpKernel\Kernel;
9
10
class AppKernel extends Kernel
11
{
12
    private $config;
13
14
    public function __construct($config)
15
    {
16
        parent::__construct('test', true);
17
18
        $fs = new Filesystem();
19
20
        if (!$fs->isAbsolutePath($config)) {
21
            $config = __DIR__.'/config/'.$config;
22
        }
23
24
        if (!file_exists($config)) {
25
            throw new \RuntimeException(sprintf('The config file "%s" does not exist', $config));
26
        }
27
28
        $this->config = $config;
29
    }
30
31
    public function registerBundles()
32
    {
33
        return [
34
            new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
35
            new HappyrAutoFallbackTranslationBundle(),
36
        ];
37
    }
38
39
    public function registerContainerConfiguration(LoaderInterface $loader)
40
    {
41
        $loader->load($this->config);
42
    }
43
44
    public function getCacheDir()
45
    {
46
        return sys_get_temp_dir().'/HappyrAutoFallbackTranslationBundle';
47
    }
48
49
    public function serialize()
50
    {
51
        return $this->config;
52
    }
53
54
    public function unserialize($config)
55
    {
56
        $this->__construct($config);
57
    }
58
}
59