DLSitemapExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 1
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