ProcessorCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 18 3
1
<?php
2
3
namespace Kasifi\PdfParserBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
/**
10
 * Class ProcessorCompilerPass.
11
 */
12
class ProcessorCompilerPass implements CompilerPassInterface
13
{
14
    public function process(ContainerBuilder $container)
15
    {
16
        if (!$container->has('kasifi_pdfparser.pdf_parser')) {
17
            return;
18
        }
19
20
        $definition = $container->findDefinition(
21
            'kasifi_pdfparser.pdf_parser'
22
        );
23
24
        $taggedServices = $container->findTaggedServiceIds('kasifi_pdfparser.processor');
25
        foreach ($taggedServices as $id => $tags) {
26
            $definition->addMethodCall(
27
                'addAvailableProcessor',
28
                [new Reference($id)]
29
            );
30
        }
31
    }
32
}
33