IvoryLuceneSearchExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 6
dl 0
loc 21
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 15 3
1
<?php
2
3
/*
4
 * This file is part of the Ivory Lucene Search package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\LuceneSearchBundle\DependencyInjection;
13
14
use Symfony\Component\Config\FileLocator;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
17
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
class IvoryLuceneSearchExtension extends Extension
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 27
    public function load(array $configs, ContainerBuilder $container)
28
    {
29 27
        $config = $this->processConfiguration(new Configuration(), $configs);
30
31 27
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
32 27
        foreach (['services'] as $resource) {
33 27
            $loader->load($resource.'.xml');
34 21
        }
35
36 27
        if (!empty($config)) {
37
            $container
38 18
                ->getDefinition('ivory_lucene_search')
39 18
                ->addMethodCall('setIndexes', [$config]);
40 14
        }
41 27
    }
42
}
43