Completed
Push — master ( 633993...9d7e2f )
by Jérémy
02:39
created

LoggerPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Thunder micro CLI framework.
7
 * (c) Jérémy Marodon <[email protected]>
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace RxThunder\Core\Logger;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Reference;
17
18
final class LoggerPass implements CompilerPassInterface
19
{
20
    public const TAG = 'logger.aware';
21
22 3
    public function process(ContainerBuilder $container): void
23
    {
24 3
        $tagged_services = $container->findTaggedServiceIds(self::TAG);
25
26 3
        foreach ($tagged_services as $id => $tags) {
27 1
            $definition = $container->findDefinition($id);
28 1
            $definition->addMethodCall('setLogger', [new Reference('logger')]);
29
        }
30 3
    }
31
}
32