Completed
Push — master ( 8cd050...5f288c )
by Andreas
22:58
created

indexerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 15 3
1
<?php
2
namespace midcom\bundle\dependencyInjection;
3
4
use Symfony\Component\DependencyInjection\ContainerBuilder;
5
use Symfony\Component\DependencyInjection\Reference;
6
7
class indexerPass extends configPass
8
{
9 1
    public function process(ContainerBuilder $container)
10
    {
11 1
        if ($class = $this->config->get('indexer_backend')) {
12 1
            if (strpos($class, '_') === false) {
13
                // Built-in backend called using the shorthand notation
14 1
                $class = "midcom_services_indexer_backend_" . $class;
15
            }
16
17 1
            $backend = $container->getDefinition('indexer.backend');
18 1
            $backend->setClass($class);
19 1
            $indexer = $container->getDefinition('indexer');
20 1
            $indexer->addArgument(new Reference('indexer.backend'));
21
22 1
            $container->getDefinition('event_dispatcher')
23 1
                ->addMethodCall('addSubscriber', [new Reference('indexer')]);
24
        }
25
    }
26
}