Completed
Branch v1.x-dev (5736e4)
by Benjamin
04:09
created

RoutesPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Obblm\Core\DependencyInjection\CompilerPass;
4
5
use Obblm\Core\Routing\RouteAutoloader;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class RoutesPass implements CompilerPassInterface
11
{
12 1
    public function process(ContainerBuilder $container)
13
    {
14 1
        $definition = $container->findDefinition(RouteAutoloader::class);
15
16 1
        foreach ($container->findTaggedServiceIds('obblm.routes') as $id => $tags) {
17 1
            $definition->addMethodCall('addObblmRoute', [new Reference($id)]);
18
        }
19 1
    }
20
}
21