Completed
Push — master ( 70e4e5...5530b2 )
by Joachim
15:31
created

ConsignmentServicePass   A

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
namespace Loevgaard\DandomainConsignmentBundle\DependencyInjection\Compiler;
3
4
use Loevgaard\DandomainConsignmentBundle\ConsignmentService\ConsignmentServiceCollection;
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class ConsignmentServicePass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container)
12
    {
13
        if (!$container->has(ConsignmentServiceCollection::class)) {
14
            return;
15
        }
16
17
        $definition = $container->findDefinition(ConsignmentServiceCollection::class);
18
19
        $taggedServices = $container->findTaggedServiceIds('ldc.consignment_service');
20
21
        foreach ($taggedServices as $id => $tags) {
22
            $definition->addMethodCall('addConsignmentService', [new Reference($id)]);
23
        }
24
    }
25
}