ConsignmentServicePass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 17
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Loevgaard\DandomainConsignmentBundle\DependencyInjection\Compiler;
6
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
class ConsignmentServicePass implements CompilerPassInterface
12
{
13
    public function process(ContainerBuilder $container)
14
    {
15
        if (!$container->has('loevgaard_dandomain_consignment.consignment_service_collection')) {
16
            return;
17
        }
18
19
        $definition = $container->findDefinition('loevgaard_dandomain_consignment.consignment_service_collection');
20
21
        $taggedServices = $container->findTaggedServiceIds('ldc.consignment_service');
22
23
        foreach ($taggedServices as $id => $tags) {
24
            $definition->addMethodCall('addConsignmentService', [new Reference($id)]);
25
        }
26
    }
27
}
28