Completed
Push — master ( 3229d6...c9eeb2 )
by Baldur
03:55
created

LAShowroomTaxJarExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 7
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 19 2
1
<?php
2
3
namespace LAShowroom\TaxJarBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\Reference;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
use Symfony\Component\DependencyInjection\Loader;
10
11
class LAShowroomTaxJarExtension extends Extension
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 6
    public function load(array $configs, ContainerBuilder $container)
17
    {
18 6
        $configuration = new Configuration();
19 6
        $config = $this->processConfiguration($configuration, $configs);
20
21 4
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
22 4
        $loader->load('services.xml');
23
24 4
        $container->setParameter('la_showroom_tax_jar.api_token', $config['api_token']);
25
26 4
        if (!empty($config['cache'])) {
27
            $container
28 2
                ->getDefinition('la_showroom_tax_jar.client')
29 2
                ->addMethodCall('setCacheItemPool', [
30 2
                    new Reference($config['cache'])
31
                ])
32
            ;
33
        }
34 4
    }
35
}
36