Completed
Push — master ( 83a9fe...bdaaf9 )
by Tobias
07:57
created

EditInPlacePass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 2
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Bundle\DependencyInjection\CompilerPass;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Definition;
17
use Symfony\Component\DependencyInjection\Reference;
18
19
/**
20
 * @author Damien Alexandre <[email protected]>
21
 */
22
class EditInPlacePass implements CompilerPassInterface
23
{
24
    public function process(ContainerBuilder $container)
25
    {
26
        /* @var Definition $def */
27
        if (!$container->hasDefinition('php_translator.edit_in_place.xtrans_html_translator')) {
28
            return;
29
        }
30
31
        // Replace the Twig Translator by a custom HTML one
32
        $container->getDefinition('twig.extension.trans')->replaceArgument(
33
            0,
34
            new Reference('php_translator.edit_in_place.xtrans_html_translator')
35
        );
36
    }
37
}
38