SonataAnnotationExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 13
c 1
b 0
f 0
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 19 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Neimheadh\SonataAnnotationBundle\DependencyInjection;
6
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
10
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
11
12
/**
13
 * SonataAnnotationBundle extension.
14
 *
15
 * @author Marko Kunic <[email protected]>
16
 * @author Mathieu Wambre <[email protected]>
17
 */
18
final class SonataAnnotationExtension extends Extension
19
{
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public function load(array $configs, ContainerBuilder $container): void
25
    {
26
        $configuration = new Configuration();
27
        $config = $this->processConfiguration($configuration, $configs);
28
29
        $container->setParameter(
30
            'sonata_annotation.directory',
31
            $config['directory'] ?? $container->getParameter(
32
                'kernel.project_dir'
33
            ) . '/src/'
34
        );
35
36
        $loader = new XmlFileLoader(
37
            $container,
38
            new FileLocator(
39
                __DIR__ . '/../Resources/config'
40
            )
41
        );
42
        $loader->load('reader.xml');
43
    }
44
45
}
46