ResolverPass   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 28
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 22 4
1
<?php declare(strict_types = 1);
2
3
namespace JDR\MailerBundle\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 ResolverPass implements CompilerPassInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function process(ContainerBuilder $container)
15
    {
16
        if (!$container->hasDefinition('jdr.mailer.part_resolver_registry')) {
17
            return;
18
        }
19
20
        $definition = $container->getDefinition(
21
            'jdr.mailer.part_resolver_registry'
22
        );
23
24
        $taggedServices = $container->findTaggedServiceIds(
25
            'jdr.mailer.resolver'
26
        );
27
        foreach ($taggedServices as $id => $tags) {
28
            foreach ($tags as $attributes) {
29
                $definition->addMethodCall(
30
                    'addResolver',
31
                    array(new Reference($id), $attributes['part'])
32
                );
33
            }
34
        }
35
    }
36
}
37