Completed
Push — master ( b9b624...8c6e53 )
by Grégoire
01:11
created

AppKernel   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 6
dl 0
loc 71
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A registerBundles() 0 8 1
A getCacheDir() 0 4 1
A getLogDir() 0 4 1
A getProjectDir() 0 4 1
A configureRoutes() 0 3 1
A configureContainer() 0 28 1
A getBaseDir() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\EasyExtendsBundle\Tests\Command\Functional;
15
16
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
17
use Sonata\EasyExtendsBundle\SonataEasyExtendsBundle;
18
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
19
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
20
use Symfony\Component\Config\Loader\LoaderInterface;
21
use Symfony\Component\DependencyInjection\ContainerBuilder;
22
use Symfony\Component\HttpKernel\Kernel;
23
use Symfony\Component\Routing\RouteCollectionBuilder;
24
25
final class AppKernel extends Kernel
26
{
27
    use MicroKernelTrait;
28
29
    public function __construct()
30
    {
31
        parent::__construct('test', false);
32
    }
33
34
    public function registerBundles()
35
    {
36
        return [
37
            new FrameworkBundle(),
38
            new DoctrineBundle(),
39
            new SonataEasyExtendsBundle(),
40
        ];
41
    }
42
43
    public function getCacheDir(): string
44
    {
45
        return $this->getBaseDir().'cache';
46
    }
47
48
    public function getLogDir(): string
49
    {
50
        return $this->getBaseDir().'log';
51
    }
52
53
    public function getProjectDir(): string
54
    {
55
        return __DIR__;
56
    }
57
58
    protected function configureRoutes(RouteCollectionBuilder $routes): void
0 ignored issues
show
Unused Code introduced by
The parameter $routes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
59
    {
60
    }
61
62
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
0 ignored issues
show
Unused Code introduced by
The parameter $loader is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
63
    {
64
        $containerBuilder->loadFromExtension('framework', [
65
            'secret' => 'MySecret',
66
        ]);
67
68
        $containerBuilder->loadFromExtension('doctrine', [
69
            'orm' => [
70
                'entity_managers' => [
71
                    'default' => [
72
                        'auto_mapping' => true,
73
                        'mappings' => [
74
                            'App' => [
75
                                'type' => 'annotation',
76
                                'dir' => '%kernel.project_dir%/Entity',
77
                                'is_bundle' => false,
78
                                'prefix' => 'Sonata\EasyExtendsBundle\Tests\Command\Functional\Entity',
79
                                'alias' => 'SonataFunctional',
80
                            ],
81
                        ],
82
                    ],
83
                ],
84
            ],
85
            'dbal' => [
86
                'driver' => 'pdo_sqlite',
87
            ],
88
        ]);
89
    }
90
91
    private function getBaseDir(): string
92
    {
93
        return sys_get_temp_dir().'/sonata-easy-extends-bundle/var/';
94
    }
95
}
96