Passed
Branch master (117216)
by Pavel
08:06
created

LinkGeneratorPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 15 4
1
<?php
2
3
namespace Bankiru\Seo\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
final class LinkGeneratorPass implements CompilerPassInterface
10
{
11
    /** {@inheritdoc} */
12
    public function process(ContainerBuilder $container)
13
    {
14
        if (!$container->has('bankiru.seo.link_generator')) {
15
            return;
16
        }
17
18
        $registry = $container->getDefinition('bankiru.seo.link_generator');
19
        $services = $container->findTaggedServiceIds('seo_link_resolver');
20
21
        foreach ($services as $id => $tags) {
22
            foreach ($tags as $attributes) {
23
                $registry->addMethodCall('addResolver', [new Reference($id)]);
24
            }
25
        }
26
    }
27
}
28