EditInPlacePass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 9 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
use Translation\Bundle\Translator\EditInPlaceTranslator;
19
20
/**
21
 * @author Damien Alexandre <[email protected]>
22
 */
23
class EditInPlacePass implements CompilerPassInterface
24
{
25 2
    public function process(ContainerBuilder $container): void
26
    {
27
        /* @var Definition $def */
28 2
        if (!$container->hasDefinition(EditInPlaceTranslator::class)) {
29 1
            return;
30
        }
31
32
        // Replace the Twig Translator by a custom HTML one
33 1
        $container->getDefinition('twig.extension.trans')->replaceArgument(0, new Reference(EditInPlaceTranslator::class));
34 1
    }
35
}
36