Completed
Push — master ( b489fc...382b22 )
by Pavel
02:38
created

LinkGeneratorPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 90.91%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 19
ccs 10
cts 11
cp 0.9091
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 1
    public function process(ContainerBuilder $container)
13
    {
14 1
        if (!$container->has('bankiru.seo.link_generator')) {
15
            return;
16
        }
17
18 1
        $registry = $container->getDefinition('bankiru.seo.link_generator');
19 1
        $services = $container->findTaggedServiceIds('seo_link_resolver');
20
21 1
        foreach ($services as $id => $tags) {
22 1
            foreach ($tags as $attributes) {
23 1
                $registry->addMethodCall('addResolver', [new Reference($id)]);
24 1
            }
25 1
        }
26 1
    }
27
}
28