ValidatorVisitorPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

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