CodeCoverageConfiguration   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 47
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onCodeCoverageStart() 0 6 2
A getReportPath() 0 4 1
A setReportPath() 0 5 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