Test Failed
Pull Request — master (#17)
by Denis
10:14
created

MakePublicCompilerPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Artprima\QueryFilterBundle\tests\functional\Test;
4
5
use LogicException;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
9
class MakePublicCompilerPass implements CompilerPassInterface
10
{
11
    private $class;
12
13
    public function __construct(string $class)
14
    {
15
        $this->class = $class;
16
    }
17
18
    public function process(ContainerBuilder $container)
19
    {
20
        if (false === $container->hasDefinition($this->class)) {
21
            throw new LogicException($this->class.' must be registered');
22
        }
23
24
        $conditionManagerDefinition = $container->getDefinition($this->class);
25
        $conditionManagerDefinition->setPublic(true);
26
    }
27
}