Completed
Push — master ( 5ef98e...13f2dd )
by Tobias
10:57
created

ValidatorVisitorPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 80%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 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
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 4
    public function process(ContainerBuilder $container)
25
    {
26 4
        if ($container->hasDefinition('validator')) {
27
            return;
28
        }
29
30 4
        $container->removeDefinition('php_translation.extractor.php.visitor.ValidationAnnotation');
31 4
    }
32
}
33