ElasticsearchExtraExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 31
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 14 1
A createIndexConfigurationRepository() 0 10 1
1
<?php
2
3
namespace GBProd\ElasticsearchExtraBundle\DependencyInjection;
4
5
use GBProd\ElasticsearchExtraBundle\Repository\IndexConfigurationRepository;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Loader;
9
use Symfony\Component\DependencyInjection\Reference;
10
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
11
12
/**
13
 * Extension class for ElasticsearchExtra bundle
14
 *
15
 * @author gbprod <[email protected]>
16
 */
17
class ElasticsearchExtraExtension extends Extension
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function load(array $configs, ContainerBuilder $container)
23
    {
24 1
        $configuration = new Configuration();
25 1
        $config = $this->processConfiguration($configuration, $configs);
26
27 1
        $this->createIndexConfigurationRepository($config, $container);
28
29 1
        $loader = new Loader\YamlFileLoader(
30 1
            $container,
31 1
            new FileLocator(__DIR__ . '/../Resources/config')
32 1
        );
33
34 1
        $loader->load('services.yml');
35 1
    }
36
37
    private function createIndexConfigurationRepository(array $config, ContainerBuilder $container)
38
    {
39
        $container
40 1
            ->register(
41 1
                'gbprod.elasticsearch_extra.index_configuration_repository',
42
                IndexConfigurationRepository::class
43 1
            )
44 1
            ->addArgument($config['indices'])
45
        ;
46 1
    }
47
}
48