UrlProviderCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 3
1
<?php
2
3
namespace Zenstruck\CacheBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
/**
10
 * @author Kevin Bond <[email protected]>
11
 */
12
class UrlProviderCompilerPass implements CompilerPassInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 3
    public function process(ContainerBuilder $container)
18
    {
19 2
        if (!$container->hasDefinition('zenstruck_cache.crawler')) {
20 2
            return;
21
        }
22
23 1
        $definition = $container->getDefinition('zenstruck_cache.crawler');
24 1
        $taggedServices = $container->findTaggedServiceIds('zenstruck_cache.url_provider');
25
26 1
        foreach ($taggedServices as $id => $attributes) {
27 1
            $definition->addMethodCall('addUrlProvider', [new Reference($id)]);
28 1
        }
29 2
    }
30
}
31