CleanupPass::process()   A
last analyzed

Complexity

Conditions 6
Paths 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 9
cts 9
cp 1
rs 9.2222
c 0
b 0
f 0
cc 6
nc 4
nop 1
crap 6
1
<?php
2
3
namespace GoetasWebservices\SoapServices\SoapClient\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
class CleanupPass implements CompilerPassInterface
9
{
10 2
    public function process(ContainerBuilder $container)
11
    {
12
        // if there are no metadata, then we are in debug mode, no need to clean up the container
13 2
        if (!$container->getParameter('goetas_webservices.soap_client.metadata')) {
14 2
            return;
15
        }
16 1
        foreach ($container->getDefinitions() as $id => $definition) {
17 1
            if (strpos($id, 'goetas_webservices.soap_client.metadata_loader.array') === false && !$definition->isSynthetic() && $definition->isPublic()) {
18 1
                $definition->setPublic(false);
19 1
            }
20 1
        }
21 1
    }
22
}
23