ElasticaProviderExtension::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 15
cts 15
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 11
nc 2
nop 2
crap 2
1
<?php
2
3
namespace GBProd\ElasticaProviderBundle\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
 * Extension class for ElasticaProviderExtension
12
 *
13
 * @author gbprod <[email protected]>
14
 */
15
class ElasticaProviderExtension extends Extension
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 4
    public function load(array $configs, ContainerBuilder $container)
21
    {
22 4
        $configuration = new Configuration();
23 4
        $config = $this->processConfiguration($configuration, $configs);
24
    
25 4
        if (null !== $config['default_client']) {
26 1
            $container->setAlias(
27 1
                'gbprod.elastica_provider.default_client', 
28 1
                $config['default_client']
29 1
            );
30 1
        }
31
        
32 4
        $loader = new Loader\YamlFileLoader(
33 4
            $container,
34 4
            new FileLocator(__DIR__.'/../Resources/config')
35 4
        );
36
37 4
        $loader->load('services.yml');
38
    }
39
}