Completed
Push — develop ( b74491...9e8dd2 )
by
unknown
12:13
created

ConverterCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 2
1
<?php
2
3
/*
4
 * This file is part of Sulu.
5
 *
6
 * (c) MASSIVE ART WebServices GmbH
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Sulu\Bundle\ArticleBundle\DependencyInjection;
13
14
use Sulu\Bundle\ArticleBundle\Elasticsearch\EventAwareConverter;
15
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Reference;
18
19
/**
20
 * Replaces class and add argument for replaced service "es.result_converter".
21
 */
22
class ConverterCompilerPass implements CompilerPassInterface
23
{
24
    const SERVICE_ID = 'es.result_converter';
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function process(ContainerBuilder $container)
30
    {
31
        if (!$container->hasDefinition(self::SERVICE_ID)) {
32
            return;
33
        }
34
35
        $definition = $container->getDefinition(self::SERVICE_ID);
36
        $definition->setClass(EventAwareConverter::class);
37
        $definition->addArgument(new Reference('event_dispatcher'));
38
    }
39
}
40