Completed
Push — master ( f27e2e...5dd696 )
by Asmir
10s
created

CleanupPass   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 15
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 12 6
1
<?php
2
namespace GoetasWebservices\SoapServices\SoapClient\DependencyInjection\Compiler;
3
4
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
7
class CleanupPass implements CompilerPassInterface
8
{
9 2
    public function process(ContainerBuilder $container)
10
    {
11
        // if there are no metadata, then we are in debug mode, no need to clean up the container
12 2
        if (!$container->getParameter('goetas_webservices.soap_client.metadata')) {
13 2
            return;
14
        }
15 1
        foreach ($container->getDefinitions() as $id => $definition) {
16 1
            if (strpos($id, 'goetas_webservices.soap_client.metadata_loader.array') === false && !$definition->isSynthetic() && $definition->isPublic()) {
17 1
                $definition->setPublic(false);
18 1
            }
19 1
        }
20 1
    }
21
}
22