CoveragePass::process()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the doyo/code-coverage project.
5
 *
6
 * (c) Anthonius Munthi <https://itstoni.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Doyo\Behat\CodeCoverage\Compiler;
15
16
use Doyo\Behat\CodeCoverage\Listener\CoverageListener;
17
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\DependencyInjection\Definition;
20
use Symfony\Component\DependencyInjection\Reference;
21
22
class CoveragePass implements CompilerPassInterface
23
{
24
    public function process(ContainerBuilder $container)
25
    {
26
        $listener = new Definition(CoverageListener::class);
27
        $listener->addArgument(new Reference('doyo.coverage'));
28
        $listener->addArgument($container->getParameterBag()->get('doyo.coverage_enabled'));
29
        $listener->addTag('event_dispatcher.subscriber');
30
31
        $container->setDefinition('doyo.coverage.listener', $listener);
32
    }
33
}
34