AddReporterCompilerPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 13
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 2
1
<?php
2
3
/**
4
 * This file is part of the `tvi/monitor-bundle` project.
5
 *
6
 * (c) https://github.com/turnaev/monitor-bundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
11
12
namespace Tvi\MonitorBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Reference;
17
use Tvi\MonitorBundle\DependencyInjection\DiTags;
18
19
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
20
 * @author Vladimir Turnaev <[email protected]>
21
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
22
class AddReporterCompilerPass implements CompilerPassInterface
23
{
24 50
    public function process(ContainerBuilder $container)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function process()
Loading history...
25
    {
26 50
        $reportersManagerDefinition = $container->getDefinition('tvi_monitor.reporters.manager');
27
28 50
        $reporterDefinitions = $container->findTaggedServiceIds(DiTags::CHECK_REPORTER);
29
30 50
        foreach ($reporterDefinitions as $id => $reporterDefinition) {
31 50
            $scope = $reporterDefinition[0]['scope'] ?? null;
32 50
            $alias = $reporterDefinition[0]['alias'];
33
34 50
            $reportersManagerDefinition->addMethodCall('addReporter', [$alias, new Reference($id), $scope]);
35
        }
36 50
    }
37
}
38