HelperPass   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 25
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

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