Passed
Push — master ( a22915...aab382 )
by Alex
02:04 queued 27s
created

AddTabCompletionMatcherPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 19 3
1
<?php
2
declare(strict_types=1);
3
4
namespace AlexMasterov\PsyshBundle\DependencyInjection\Compiler;
5
6
use Symfony\Component\DependencyInjection\{
7
    Compiler\CompilerPassInterface,
8
    ContainerBuilder,
9
    Reference
10
};
11
12
class AddTabCompletionMatcherPass implements CompilerPassInterface
13
{
14
    /**
15
     * @inheritDoc
16
     */
17 2
    public function process(ContainerBuilder $container)
18
    {
19 2
        if (false === $container->has('psysh.shell')) {
20 1
            return;
21
        }
22
23 2
        $services = $container->findTaggedServiceIds('psysh.matcher', true);
24 2
        if (empty($services)) {
25 1
            return;
26
        }
27
28 1
        $matchers = \array_map(
29
            static function ($id) { return new Reference($id); },
30 1
            \array_keys($services)
31
        );
32
33 1
        $container->getDefinition('psysh.config')
34 1
            ->addMethodCall('addTabCompletionMatchers', [$matchers]);
35 1
    }
36
}
37