DLSitemapExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 5
dl 0
loc 30
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 7 1
A processServiceDefinition() 0 11 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace DL\SitemapBundle\DependencyInjection;
5
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
9
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
10
11
/**
12
 * Bundle service definition and processing of
13
 * semantic configuration.
14
 *
15
 * @package DL\SitemapBundle\DependencyInjection
16
 * @author  Petre Pătrașc <[email protected]>
17
 */
18
class DLSitemapExtension extends Extension
19
{
20
    /**
21
     * @inheritDoc
22
     */
23 1
    public function load(array $configs, ContainerBuilder $container)
24
    {
25 1
        $configs = $this->processConfiguration(new DLSitemapConfiguration, $configs);
26 1
        $container->setParameter('sitemap_location_prefix', $configs['location_prefix']);
27
28 1
        $this->processServiceDefinition($container);
29 1
    }
30
31
    /**
32
     * Process the service definition from a list of configuration files.
33
     *
34
     * @param ContainerBuilder $container
35
     */
36 1
    private function processServiceDefinition(ContainerBuilder $container)
37
    {
38
        $definitionFiles = [
39 1
            'services.yml',
40
        ];
41
42 1
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
43 1
        foreach ($definitionFiles as $file) {
44 1
            $loader->load($file);
45
        }
46 1
    }
47
}
48