PostmanGeneratorExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 13
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 2
crap 2
1
<?php
2
3
/*
4
 * This file is part of the PostmanGeneratorBundle package.
5
 *
6
 * (c) Vincent Chalamon <[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 PostmanGeneratorBundle\DependencyInjection;
13
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\DependencyInjection\Extension\Extension;
16
use Symfony\Component\Config\FileLocator;
17
use Symfony\Component\DependencyInjection\Loader;
18
19
class PostmanGeneratorExtension extends Extension
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function load(array $configs, ContainerBuilder $container)
25
    {
26
        $configuration = new Configuration();
27
        $config = $this->processConfiguration($configuration, $configs);
28
29
        $container->setParameter('postman.name', $config['name']);
30
        $container->setParameter('postman.baseUrl', $config['baseUrl']);
31
        $container->setParameter('postman.description', $config['description']);
32
        $container->setParameter('postman.authentication', $config['authentication']);
33
        $container->setParameter('postman.public', $config['public']);
34
        $container->setParameter('postman.defaultLocale', $config['defaultLocale']);
35
36
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
37
        $loader->load('services.xml');
38
    }
39
}
40