RegisterClientDecodersPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
ccs 9
cts 9
cp 1
rs 9.4286
cc 2
eloc 7
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Innmind\RestBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class RegisterClientDecodersPass implements CompilerPassInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 2
    public function process(ContainerBuilder $container)
15
    {
16 2
        $delegation = $container->getDefinition('innmind_rest.client.decoder.delegation');
17 2
        $ids = $container->findTaggedServiceIds('innmind_rest.client.decoder');
18 2
        $decoders = [];
19
20 2
        foreach ($ids as $id => $tags) {
21 2
            $decoders[] = new Reference($id);
22 2
        }
23
24 2
        $delegation->replaceArgument(0, $decoders);
25 2
    }
26
}
27