Test Failed
Push — master ( 414f7e...189d81 )
by Andrey
02:42
created

SubmarineNbrbExchangeRatesExtension::load()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 41
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 41
rs 8.8571
cc 1
eloc 23
nc 1
nop 2
1
<?php
2
3
namespace Submarine\NbrbExchangeRatesBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8
use Symfony\Component\DependencyInjection\Loader;
9
10
/**
11
 * This is the class that loads and manages your bundle configuration
12
 *
13
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
14
 */
15
class SubmarineNbrbExchangeRatesExtension extends Extension
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function load(array $configs, ContainerBuilder $container)
21
    {
22
        $configuration = new Configuration();
23
        $config = $this->processConfiguration($configuration, $configs);
24
25
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
26
        $loader->load('services.yml');
27
28
        // Source
29
        $container->setParameter(
30
            'submarine_nbrb_exchange_rates.source.url_exchange_rates',
31
            $config['source']['url_exchange_rates']
32
        );
33
34
        $container->setParameter(
35
            'submarine_nbrb_exchange_rates.source.url_exchange_rates_dynamic',
36
            $config['source']['url_exchange_rates_dynamic']
37
        );
38
39
        $container->setParameter(
40
            'submarine_nbrb_exchange_rates.source.connect_timeout',
41
            $config['source']['connect_timeout']
42
        );
43
44
        $container->setParameter(
45
            'submarine_nbrb_exchange_rates.source.timeout',
46
            $config['source']['timeout']
47
        );
48
49
        // Other
50
        $container->setParameter(
51
            'submarine_nbrb_exchange_rates.exception',
52
            $config['exception']
53
        );
54
55
        $container->setParameter(
56
            'submarine_nbrb_exchange_rates.scaled_name',
57
            $config['scaled_name']
58
        );
59
60
    }
61
}
62