Completed
Push — develop ( e4e826...d92786 )
by ANTHONIUS
11s queued 10s
created

Report::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Doyo\Behat\Coverage\Bridge;
4
5
use Doyo\Behat\Coverage\Event\ReportEvent;
6
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
8
class Report implements EventSubscriberInterface
9
{
10
    /**
11
     * @var object
12
     */
13
    private $processor;
14
15
    /**
16
     * @var string
17
     */
18
    private $name;
19
20
    /**
21
     * @var string
22
     */
23
    private $target;
24
25 2
    public static function getSubscribedEvents()
26
    {
27
        return [
28 2
            ReportEvent::PROCESS => 'onReportProcess'
29
        ];
30
    }
31
32
    /**
33
     * @return object
34
     */
35 1
    public function getProcessor()
36
    {
37 1
        return $this->processor;
38
    }
39
40
    /**
41
     * @param object $processor
42
     * @return Report
43
     */
44 3
    public function setProcessor($processor)
45
    {
46 3
        $this->processor = $processor;
47
48 3
        return $this;
49
    }
50
51
    /**
52
     * @return string
53
     */
54 1
    public function getName()
55
    {
56 1
        return $this->name;
57
    }
58
59
    /**
60
     * @param string $name
61
     * @return Report
62
     */
63 3
    public function setName($name)
64
    {
65 3
        $this->name = $name;
66 3
        return $this;
67
    }
68
69
    /**
70
     * @return string
71
     */
72 1
    public function getTarget()
73
    {
74 1
        return $this->target;
75
    }
76
77
    /**
78
     * @param string $target
79
     * @return Report
80
     */
81 3
    public function setTarget($target)
82
    {
83 3
        $this->target = $target;
84 3
        return $this;
85
    }
86
87 1
    public function onReportProcess(ReportEvent $event)
88
    {
89 1
        $coverage = $event->getCoverage();
90
91
        /* @todo process this error message */
92
        try{
93 1
            $this->processor->process($coverage, $this->target, $this->name);
94
        }catch (\Exception $e){
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
95
96
        }
97
    }
98
}
99