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

CoveragePrinter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onEngineBeforeStart() 0 18 4
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