Completed
Push — master ( d72a06...ba0ad0 )
by GBProd
04:38
created

ElasticsearchExtraExtension::getClientsReferences()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 9.4285
cc 2
eloc 8
nc 2
nop 1
crap 2
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