Completed
Pull Request — 3.x (#609)
by Wojciech
07:31
created

AppKernel::getLogDir()   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\TwigBundle\TwigBundle;
31
use Symfony\Component\Config\Loader\LoaderInterface;
32
use Symfony\Component\DependencyInjection\ContainerBuilder;
33
use Symfony\Component\HttpKernel\Kernel;
34
use Symfony\Component\Routing\RouteCollectionBuilder;
35
36
final class AppKernel extends Kernel
37
{
38
    use MicroKernelTrait;
39
40
    public function __construct()
41
    {
42
        parent::__construct('test', false);
43
    }
44
45
    public function registerBundles()
46
    {
47
        return [
48
            new FrameworkBundle(),
49
            new TwigBundle(),
50
            new SecurityBundle(),
51
            new DoctrineBundle(),
52
            new KnpMenuBundle(),
53
            new SonataBlockBundle(),
54
            new SonataDoctrineBundle(),
55
            new SonataFormBundle(),
56
            new SonataTwigBundle(),
57
            new SonataClassificationBundle(),
58
            new SonataIntlBundle(),
59
            new SonataMediaBundle(),
60
            new SonataNewsBundle(),
61
            new JMSSerializerBundle(),
62
        ];
63
    }
64
65
    public function getCacheDir(): string
66
    {
67
        return $this->getBaseDir().'cache';
68
    }
69
70
    public function getLogDir(): string
71
    {
72
        return $this->getBaseDir().'log';
73
    }
74
75
    public function getProjectDir()
76
    {
77
        return __DIR__;
78
    }
79
80
    protected function configureRoutes(RouteCollectionBuilder $routes)
81
    {
82
        $routes->import($this->getProjectDir().'/config/routes.yaml');
83
    }
84
85
    protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader)
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...
86
    {
87
        $loader->load($this->getProjectDir().'/config/config.yaml');
88
    }
89
90
    private function getBaseDir(): string
91
    {
92
        return sys_get_temp_dir().'/sonata-news-bundle/var/';
93
    }
94
}
95