Completed
Push — symfony4 ( c6a911...b0a2f3 )
by
unknown
37:19
created

ReplaceServiceContainerPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 4
1
<?php
2
3
/**
4
 * File containing the FieldTypeCollectionPass class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\Base\Container\Compiler;
10
11
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
12
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
15
/**
16
 * This Pass overrides all services to be public.
17
 *
18
 * It is a workaround to the change in Symfony 4 which makes all services private by default.
19
 * Our integration tests are not prepared for this as they get services directly from the Container.
20
 *
21
 * WARNING! DO NOT USE IT IN YOUR APPLICATION.
22
 *
23
 * Inspired by \Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerWeakRefPass
24
 */
25
class ReplaceServiceContainerPass implements CompilerPassInterface
26
{
27
    /**
28
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $containerBuilder
29
     */
30
    public function process(ContainerBuilder $containerBuilder)
31
    {
32
        foreach ($containerBuilder->getDefinitions() as $id => $definition) {
33
            $methodCalls = $definition->getMethodCalls();
34
            foreach ($methodCalls as $callIndex => $methodCall) {
35
                if ($methodCall[0] !== 'setContainer') {
36
                    continue;
37
                }
38
            }
39
        }
40
    }
41
}
42