Completed
Pull Request — master (#40)
by Marko
445:50 queued 380:43
created

TestContainerPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 8 3
1
<?php
2
3
/*
4
 * This file is part of the Symfony CMF package.
5
 *
6
 * (c) 2011-2017 Symfony CMF
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 FOS\CKEditorBundle\Tests\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
/**
18
 * @author Maximilian Berghoff <[email protected]>
19
 */
20
class TestContainerPass implements CompilerPassInterface
21
{
22
    /**
23
     * An array of service id's which should be public in a test scenario.
24
     *
25
     * @var array
26
     */
27
    private $services = [];
28
29
    public function __construct(array $services = [])
30
    {
31
        $this->services = $services;
32
    }
33
34
    public function process(ContainerBuilder $container)
35
    {
36
        foreach ($container->getDefinitions() as $id => $definition) {
37
            if (in_array($id, $this->services, true)) {
38
                $definition->setPublic(true);
39
            }
40
        }
41
    }
42
}
43