CodeCoverageConfiguration::onCodeCoverageStart()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Peridot\Reporter;
4
5
use Evenement\EventEmitterInterface;
6
use Peridot\Reporter\CodeCoverage\AbstractCodeCoverageReporter;
7
8
/**
9
 * Class CodeCoverageConfiguration
10
 * @package Peridot\Reporter
11
 */
12
class CodeCoverageConfiguration
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $reportPath;
18
19
    /**
20
     * Constructor.
21
     *
22
     * @param EventEmitterInterface $eventEmitter
23
     */
24
    public function __construct(EventEmitterInterface $eventEmitter)
25
    {
26
        $eventEmitter->on('code-coverage.start', [$this, 'onCodeCoverageStart']);
27
    }
28
29
    /**
30
     * Handle the code-coverage.start event.
31
     *
32
     * @param AbstractCodeCoverageReporter $reporter
33
     */
34
    public function onCodeCoverageStart(AbstractCodeCoverageReporter $reporter)
35
    {
36
        if ($this->reportPath) {
37
            $reporter->setReportPath($this->getReportPath());
38
        }
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getReportPath()
45
    {
46
        return $this->reportPath;
47
    }
48
49
    /**
50
     * @param string $reportPath
51
     * @return $this
52
     */
53
    public function setReportPath($reportPath)
54
    {
55
        $this->reportPath = $reportPath;
56
        return $this;
57
    }
58
}
59