Passed
Push — master ( 482ae9...59f703 )
by Andreas
22:54
created

indexerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 16
ccs 9
cts 9
cp 1
rs 10
wmc 3

1 Method

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