AddLoaderToValidationBuilderPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 12
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Happyr\AnnotationWarmer\DependencyInjection\CompilerPass;
6
7
use Happyr\AnnotationWarmer\Loader\FakeValidatorLoader;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
/**
13
 * @author Tobias Nyholm <[email protected]>
14
 */
15
final class AddLoaderToValidationBuilderPass implements CompilerPassInterface
16
{
17
    public function process(ContainerBuilder $container)
18
    {
19
        if (!$container->hasDefinition('validator.builder')) {
20
            return;
21
        };
22
23
        $validatorBuilder = $container->getDefinition('validator.builder');
24
        $validatorBuilder->addMethodCall('addLoader', [new Reference(FakeValidatorLoader::class)]);
25
    }
26
}
27