Speicher210FastbillExtension::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 18
ccs 13
cts 13
cp 1
rs 9.4285
cc 2
eloc 12
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Speicher210\FastbillBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Loader;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
10
/**
11
 * This is the class that loads and manages your bundle configuration
12
 */
13
class Speicher210FastbillExtension extends Extension
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 3
    public function load(array $configs, ContainerBuilder $container)
19
    {
20 3
        $configuration = new Configuration();
21 3
        $config = $this->processConfiguration($configuration, $configs);
22
23 3
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
24 3
        $loader->load('services.xml');
25
26 3
        if ($container->getParameter('kernel.debug') === true) {
27 3
            $loader->load('collector.xml');
28 3
        }
29
30
        $container
31 3
            ->getDefinition('speicher210_fastbill.api_credentials')
32 3
            ->addArgument($config['username'])
33 3
            ->addArgument($config['api_key'])
34 3
            ->addArgument($config['account_hash']);
35 3
    }
36
}
37