Completed
Push — master ( 5bb837...3f2b21 )
by Alessandro
06:15
created

CoveragePrinter::onEngineBeforeStart()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
rs 9.2
cc 4
eloc 9
nc 6
nop 1
1
<?php
2
3
4
namespace Paraunit\Printer;
5
6
use Paraunit\Configuration\PHPDbgBinFile;
7
use Paraunit\Lifecycle\EngineEvent;
8
9
/**
10
 * Class CoveragePrinter
11
 * @package Paraunit\Printer
12
 */
13
class CoveragePrinter
14
{
15
    /** @var  PHPDbgBinFile */
16
    private $phpdgbBin;
17
18
    /**
19
     * CoveragePrinter constructor.
20
     * @param PHPDbgBinFile $phpdgbBin
21
     */
22
    public function __construct(PHPDbgBinFile $phpdgbBin)
23
    {
24
        $this->phpdgbBin = $phpdgbBin;
25
    }
26
27
    public function onEngineBeforeStart(EngineEvent $engineEvent)
28
    {
29
        $output = $engineEvent->getOutputInterface();
30
31
        $output->write('Coverage driver in use: ');
32
33
        if ($this->phpdgbBin->isAvailable()) {
34
            $output->writeln('PHPDBG');
35
36
            if (extension_loaded('xdebug')) {
37
                $output->writeln('WARNING: both drivers found (PHPDBG, xDebug); this may lead to memory exhaustion');
38
            }
39
        }
40
41
        if (extension_loaded('xdebug')) {
42
            $output->writeln('xDebug');
43
        }
44
    }
45
}
46