CircuitBreakerPass::process()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 10
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 19
rs 9.9332
1
<?php
2
3
namespace RedirectionIO\Client\ProxySymfony\DependencyInjection\CompilerPass;
4
5
use RedirectionIO\Client\ProxySymfony\EventListener\RequestResponseListener;
6
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...\TaggedIteratorArgument 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...
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
use Symfony\Component\DependencyInjection\Reference;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\DependencyInjection\Reference 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...
10
11
/**
12
 * @internal
13
 */
14
final class CircuitBreakerPass implements CompilerPassInterface
15
{
16
    public function process(ContainerBuilder $container)
17
    {
18
        if (!$container->hasDefinition(RequestResponseListener::class)) {
19
            return;
20
        }
21
22
        $definition = $container->getDefinition(RequestResponseListener::class);
23
24
        if (class_exists(TaggedIteratorArgument::class)) {
25
            $definition->replaceArgument(2, new TaggedIteratorArgument('redirectionio.circuit_breaker'));
26
27
            return;
28
        }
29
30
        $ids = [];
31
        foreach ($container->findTaggedServiceIds('redirectionio.circuit_breaker') as $id => $_) {
32
            $ids[] = new Reference($id);
33
        }
34
        $definition->replaceArgument(2, $ids);
35
    }
36
}
37