AppKernel::getProjectDir()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App;
6
7
use Doctrine\Bundle\DoctrineSkeletonMapperBundle\DoctrineSkeletonMapperBundle;
8
use Doctrine\Bundle\DoctrineStaticWebsiteGeneratorBundle\DoctrineStaticWebsiteGeneratorBundle;
9
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
10
use Symfony\Component\Config\Loader\LoaderInterface;
11
use Symfony\Component\HttpKernel\Bundle\Bundle;
12
use Symfony\Component\HttpKernel\Kernel;
13
use function assert;
14
use function in_array;
15
use function realpath;
16
17
class AppKernel extends Kernel
18
{
19
    /**
20
     * @return Bundle[]
21
     */
22
    public function registerBundles() : array
23
    {
24
        $bundles = [];
25
26
        if (in_array($this->getEnvironment(), ['test'], true)) {
27
            $bundles[] = new FrameworkBundle();
28
            $bundles[] = new DoctrineSkeletonMapperBundle();
29
            $bundles[] = new DoctrineStaticWebsiteGeneratorBundle();
30
        }
31
32
        return $bundles;
33
    }
34
35
    public function registerContainerConfiguration(LoaderInterface $loader) : void
36
    {
37
        $loader->load(__DIR__ . '/../config/config.yml');
38
    }
39
40
    public function getProjectDir() : string
41
    {
42
        $projectDir = realpath(__DIR__ . '/..');
43
        assert($projectDir !== false);
44
45
        return $projectDir;
46
    }
47
48
    public function getRootDir() : string
49
    {
50
        $rootDir = realpath(__DIR__ . '/..');
51
        assert($rootDir !== false);
52
53
        return $rootDir;
54
    }
55
}
56