AppKernel::getLogDir()   A
last analyzed

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