Completed
Push — master ( af131c...781e0b )
by
unknown
04:15
created

AbstractPass::addMethodCallToCrawler()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 3
crap 6
1
<?php
2
3
namespace MediaMonks\CrawlerBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
abstract class AbstractPass implements CompilerPassInterface
10
{
11
    /**
12
     * @param ContainerBuilder $container
13
     * @param string $tag
14
     * @param string $methodName
15
     */
16
    protected function addMethodCallToCrawler(ContainerBuilder $container, $tag, $methodName)
17
    {
18
        $definition = $container->findDefinition('mediamonks_crawler.crawler');
19
20
        $taggedServices = $container->findTaggedServiceIds($tag);
21
        foreach ($taggedServices as $id => $tags) {
22
            $definition->addMethodCall($methodName, [new Reference($id)]);
23
        }
24
    }
25
}
26