LoopBackApiExtension::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
dl 0
loc 12
rs 9.4285
c 2
b 1
f 0
cc 2
eloc 7
nc 2
nop 2
1
<?php
2
3
/*
4
 * This file is part of the LoopBackApiBundle package.
5
 *
6
 * (c) Théo FIDRY <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Fidry\LoopBackApiBundle\DependencyInjection;
13
14
use Symfony\Component\Config\FileLocator;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Loader;
17
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
18
19
/**
20
 * The extension of this bundle.
21
 *
22
 * @author Théo FIDRY <[email protected]>
23
 */
24
class LoopBackApiExtension extends Extension
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function load(array $configs, ContainerBuilder $container)
30
    {
31
        $configuration = new Configuration();
32
        $config = $this->processConfiguration($configuration, $configs);
33
34
        foreach ($config['parameters'] as $key => $value) {
35
            $container->setParameter(sprintf('%s.parameter.%s', $this->getAlias(), $key), $value);
36
        }
37
38
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
39
        $loader->load('services.xml');
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getAlias()
46
    {
47
        return 'loopback_api';
48
    }
49
}
50