Completed
Push — master ( 740372...dc5b6e )
by Tobias
10:09
created

ValidatorVisitorPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.2559

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 3
cts 5
cp 0.6
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2.2559
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
17
/**
18
 * If the "validation" service does not exists, then disable the visitor.
19
 *
20
 * @author Tobias Nyholm <[email protected]>
21
 */
22
class ValidatorVisitorPass implements CompilerPassInterface
23
{
24 9
    public function process(ContainerBuilder $container)
25
    {
26 9
        if ($container->hasDefinition('validator')) {
27 9
            return;
28
        }
29
30
        $container->removeDefinition('php_translation.extractor.php.visitor.ValidationAnnotation');
31
    }
32
}
33