Passed
Push — 0.4 ( 487c21 )
by jean
05:10
created

RemoveUnconfigurableStepCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Darkilliant\ProcessBundle\DependencyInjection\CompilerPass;
6
7
use Darkilliant\ProcessBundle\Filter\ValidatorFilter;
8
use Darkilliant\ProcessBundle\Step\ValidateObjectStep;
9
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
12
/**
13
 * @internal
14
 * @codeCoverageIgnore
15
 */
16
class RemoveUnconfigurableStepCompilerPass implements CompilerPassInterface
17
{
18
    public function process(ContainerBuilder $container)
19
    {
20
        // Service depends of validator
21
        if (!$container->hasDefinition('validator')) {
22
            $container->removeDefinition(ValidateObjectStep::class);
23
            $container->removeDefinition(ValidatorFilter::class);
24
        }
25
    }
26
}
27