Completed
Pull Request — master (#4)
by Pavel
10:02
created

ApiFactoryPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 18
ccs 8
cts 9
cp 0.8889
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 3
1
<?php
2
3
namespace Bankiru\Api\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 ApiFactoryPass implements CompilerPassInterface
10
{
11
    /** {@inheritdoc} */
12 5
    public function process(ContainerBuilder $container)
13
    {
14 5
        if (!$container->hasDefinition('bankiru_api.api_factory.chain')) {
15
            return;
16
        }
17
18 5
        $chain = $container->getDefinition('bankiru_api.api_factory.chain');
19
20 5
        $factories = $container->findTaggedServiceIds('bankiru.api_factory');
21
22 5
        foreach ($factories as $id => $tags) {
23 5
            $chain->addMethodCall('add', [new Reference($id)]);
24 5
        }
25 5
    }
26
}
27