FlyingColoursTwilioTwoFactorExtension::load()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 26
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 11
c 1
b 0
f 1
dl 0
loc 26
ccs 11
cts 11
cp 1
rs 9.9
cc 4
nc 3
nop 2
crap 4
1
<?php
2
3
namespace FlyingColours\TwilioTwoFactorBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\DependencyInjection\Loader;
9
10
class FlyingColoursTwilioTwoFactorExtension extends Extension
11
{
12 1
    public function load(array $configs, ContainerBuilder $container)
13
    {
14 1
        $config = $this->processConfiguration(new Configuration(), $configs);
15
16 1
        foreach($config as $l1 => $val1)
17
        {
18 1
            if(is_array($val1))
19
            {
20 1
                foreach ($val1 as $l2 => $val2)
21
                {
22 1
                    $container->setParameter(sprintf('flying_colours_twilio_two_factor.%s.%s', $l1, $l2), $val2);
23
                }
24
            }
25
            else
26
            {
27 1
                $container->setParameter(sprintf('flying_colours_twilio_two_factor.%s', $l1), $val1);
28
            }
29
30
        }
31
32 1
        $loader = new Loader\YamlFileLoader(
33 1
            $container,
34 1
            new FileLocator(__DIR__ . '/../Resources/config')
35
        );
36
37 1
        $loader->load('services.yml');
38
39
40 1
    }
41
}
42