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

MakePublicCompilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 17
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
A __construct() 0 3 1
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
}