Passed
Push — master ( 6d3c0a...a3fff6 )
by one
02:54
created

Kernel::getProjectDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App;
4
5
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
0 ignored issues
show
Bug introduced by
The type Symfony\Bundle\Framework...Kernel\MicroKernelTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\Config\Loader\LoaderInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Config\Loader\LoaderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\Config\Resource\FileResource;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Config\Resource\FileResource was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpKernel\Kernel was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Symfony\Component\Routing\RouteCollectionBuilder;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Routing\RouteCollectionBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
12
class Kernel extends BaseKernel
13
{
14
    use MicroKernelTrait;
15
16
    private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
17
18
    public function registerBundles(): iterable
19
    {
20
        $contents = require $this->getProjectDir().'/config/bundles.php';
21
        foreach ($contents as $class => $envs) {
22
            if ($envs[$this->environment] ?? $envs['all'] ?? false) {
23
                yield new $class();
24
            }
25
        }
26
    }
27
28
    public function getProjectDir(): string
29
    {
30
        return \dirname(__DIR__);
31
    }
32
33
    protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
34
    {
35
        $container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
36
        $container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
37
        $container->setParameter('container.dumper.inline_factories', true);
38
        $confDir = $this->getProjectDir().'/config';
39
40
        $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
41
        $loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
42
        $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
43
        $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
44
    }
45
46
    protected function configureRoutes(RouteCollectionBuilder $routes): void
47
    {
48
        $confDir = $this->getProjectDir().'/config';
49
50
        $routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
51
        $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
52
        $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
53
    }
54
}
55