Completed
Push — master ( 71dd86...39d07c )
by
unknown
12:25 queued 11s
created

AppKernel::getBaseDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\NewsBundle\Tests\App;
15
16
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
17
use JMS\SerializerBundle\JMSSerializerBundle;
18
use Knp\Bundle\MenuBundle\KnpMenuBundle;
19
use Sonata\BlockBundle\SonataBlockBundle;
20
use Sonata\ClassificationBundle\SonataClassificationBundle;
21
use Sonata\Doctrine\Bridge\Symfony\Bundle\SonataDoctrineBundle;
22
use Sonata\Form\Bridge\Symfony\SonataFormBundle;
23
use Sonata\IntlBundle\SonataIntlBundle;
24
use Sonata\MediaBundle\SonataMediaBundle;
25
use Sonata\NewsBundle\SonataNewsBundle;
26
use Sonata\Twig\Bridge\Symfony\SonataTwigBundle;
27
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
28
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
29
use Symfony\Bundle\SecurityBundle\SecurityBundle;
30
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
31
use Symfony\Bundle\TwigBundle\TwigBundle;
32
use Symfony\Component\Config\Loader\LoaderInterface;
33
use Symfony\Component\DependencyInjection\ContainerBuilder;
34
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
35
use Symfony\Component\HttpKernel\Kernel;
36
use Symfony\Component\Routing\RouteCollectionBuilder;
37
38
final class AppKernel extends Kernel
39
{
40
    use MicroKernelTrait;
41
42
    public function __construct()
43
    {
44
        parent::__construct('test', false);
45
    }
46
47
    /**
48
     * @return BundleInterface[]
49
     */
50
    public function registerBundles(): iterable
51
    {
52
        return [
53
            new FrameworkBundle(),
54
            new TwigBundle(),
55
            new SecurityBundle(),
56
            new DoctrineBundle(),
57
            new KnpMenuBundle(),
58
            new SonataBlockBundle(),
59
            new SonataDoctrineBundle(),
60
            new SonataFormBundle(),
61
            new SonataTwigBundle(),
62
            new SonataClassificationBundle(),
63
            new SonataIntlBundle(),
64
            new SonataMediaBundle(),
65
            new SonataNewsBundle(),
66
            new JMSSerializerBundle(),
67
            new SwiftmailerBundle(),
68
        ];
69
    }
70
71
    public function getCacheDir(): string
72
    {
73
        return $this->getBaseDir().'cache';
74
    }
75
76
    public function getLogDir(): string
77
    {
78
        return $this->getBaseDir().'log';
79
    }
80
81
    public function getProjectDir()
82
    {
83
        return __DIR__;
84
    }
85
86
    protected function configureRoutes(RouteCollectionBuilder $routes): void
87
    {
88
        $routes->import($this->getProjectDir().'/config/routes.yaml');
89
    }
90
91
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
0 ignored issues
show
Unused Code introduced by
The parameter $containerBuilder 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...
92
    {
93
        $loader->load($this->getProjectDir().'/config/config.yaml');
94
    }
95
96
    private function getBaseDir(): string
97
    {
98
        return sys_get_temp_dir().'/sonata-news-bundle/var/';
99
    }
100
}
101