1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of cloak. |
5
|
|
|
* |
6
|
|
|
* (c) Noritaka Horio <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace cloak\result; |
13
|
|
|
|
14
|
|
|
use cloak\value\Coverage; |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Trait CoverageResult |
19
|
|
|
* @package cloak\result |
20
|
|
|
*/ |
21
|
|
|
trait CoverageResult |
22
|
|
|
{ |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var \cloak\result\collection\LineResultCollection |
26
|
|
|
*/ |
27
|
|
|
protected $lineResults; |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @return int |
32
|
|
|
*/ |
33
|
|
|
public function getLineCount() |
34
|
|
|
{ |
35
|
|
|
return $this->lineResults->getLineCount(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return int |
40
|
|
|
*/ |
41
|
|
|
public function getDeadLineCount() |
42
|
|
|
{ |
43
|
|
|
return $this->lineResults->getDeadLineCount(); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return int |
48
|
|
|
*/ |
49
|
|
|
public function getUnusedLineCount() |
50
|
|
|
{ |
51
|
|
|
return $this->lineResults->getUnusedLineCount(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return int |
56
|
|
|
*/ |
57
|
|
|
public function getExecutedLineCount() |
58
|
|
|
{ |
59
|
|
|
return $this->lineResults->getExecutedLineCount(); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return int |
64
|
|
|
*/ |
65
|
|
|
public function getExecutableLineCount() |
66
|
|
|
{ |
67
|
|
|
return $this->lineResults->getExecutableLineCount(); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return Coverage The value of code coverage |
72
|
|
|
*/ |
73
|
|
|
public function getCodeCoverage() |
74
|
|
|
{ |
75
|
|
|
return $this->lineResults->getCodeCoverage(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param Coverage $coverage |
80
|
|
|
* @return bool |
81
|
|
|
*/ |
82
|
|
|
public function isCoverageLessThan(Coverage $coverage) |
83
|
|
|
{ |
84
|
|
|
return $this->lineResults->isCoverageLessThan($coverage); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param Coverage $coverage |
89
|
|
|
* @return bool |
90
|
|
|
*/ |
91
|
|
|
public function isCoverageGreaterEqual(Coverage $coverage) |
92
|
|
|
{ |
93
|
|
|
return $this->lineResults->isCoverageGreaterEqual($coverage); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param CoverageResultVisitor $visitor |
98
|
|
|
*/ |
99
|
|
|
public function accept(CoverageResultVisitor $visitor) |
100
|
|
|
{ |
101
|
|
|
$visitor->visit($this); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
} |
105
|
|
|
|