RdvMigrationExtension::load()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 15
rs 9.4285
cc 3
eloc 9
nc 3
nop 2
1
<?php
2
3
namespace RDV\Bundle\MigrationBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
10
class RdvMigrationExtension extends Extension
11
{
12
    public function load(array $configs, ContainerBuilder $container)
13
    {
14
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
15
        $loader->load('services.yml');
16
17
        $configuration = new Configuration();
18
        $config = $this->processConfiguration($configuration, $configs);
19
20
        foreach ($config as $key => $value) {
21
            $param = 'rdv_migration.' . $key;
22
            if (!$container->hasParameter($param)) {
23
                $container->setParameter($param, $value);
24
            }
25
        }
26
    }
27
}
28