Passed
Push — master ( dba7cd...d89126 )
by Asmir
01:36
created

CleanupPass::process()   A

Complexity

Conditions 6
Paths 4

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
eloc 5
nc 4
nop 1
dl 0
loc 10
rs 9.2222
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GoetasWebservices\SoapServices\Metadata\DependencyInjection\Compiler;
6
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...r\CompilerPassInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class CleanupPass implements CompilerPassInterface
11
{
12
    public function process(ContainerBuilder $container): void
13
    {
14
        // if there are no metadata, then we are in debug mode, no need to clean up the container
15
        if (!$container->getParameter('goetas_webservices.soap.metadata')) {
16
            return;
17
        }
18
19
        foreach ($container->getDefinitions() as $id => $definition) {
20
            if (false === strpos($id, 'goetas_webservices.soap.metadata_loader.array') && !$definition->isSynthetic() && $definition->isPublic()) {
21
                $definition->setPublic(false);
22
            }
23
        }
24
    }
25
}
26