Completed
Push — master ( 52d799...bb7198 )
by Tobias
13:11
created

EditInPlacePass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 16
ccs 8
cts 8
cp 1
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 3
    public function process(ContainerBuilder $container)
25
    {
26
        /* @var Definition $def */
27 3
        if (!$container->hasDefinition('php_translator.edit_in_place.xtrans_html_translator')) {
28 1
            return;
29
        }
30
31
        // Replace the Twig Translator by a custom HTML one
32 2
        $container->getDefinition('twig.extension.trans')->replaceArgument(
33 2
            0,
34 2
            new Reference('php_translator.edit_in_place.xtrans_html_translator')
35 2
        );
36 2
    }
37
}
38