1 | <?php |
||
30 | class LineResultCollection implements CodeCoverageResult, LineResultSelectable, LineCountResult, Collection |
||
31 | { |
||
32 | |||
33 | use ElementStackable; |
||
34 | |||
35 | /** |
||
36 | * @param array $lines |
||
37 | */ |
||
38 | public function __construct(array $lines = []) |
||
42 | |||
43 | /** |
||
44 | * @return int |
||
45 | */ |
||
46 | public function getLineCount() |
||
50 | |||
51 | /** |
||
52 | * @return int |
||
53 | */ |
||
54 | public function getDeadLineCount() |
||
55 | { |
||
56 | $lines = $this->selectLines(function(LineResult $line) { |
||
57 | return $line->isDead(); |
||
58 | }); |
||
59 | return $lines->count(); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return int |
||
64 | */ |
||
65 | public function getUnusedLineCount() |
||
66 | { |
||
67 | $lines = $this->selectLines(function(LineResult $line) { |
||
68 | return $line->isUnused(); |
||
69 | }); |
||
70 | return $lines->count(); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return int |
||
75 | */ |
||
76 | public function getExecutedLineCount() |
||
77 | { |
||
78 | $lines = $this->selectLines(function(LineResult $line) { |
||
79 | return $line->isExecuted(); |
||
80 | }); |
||
81 | return $lines->count(); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @return int |
||
86 | */ |
||
87 | public function getExecutableLineCount() |
||
91 | |||
92 | /** |
||
93 | * @return Coverage The value of code coverage |
||
94 | */ |
||
95 | public function getCodeCoverage() |
||
99 | |||
100 | /** |
||
101 | * @param Coverage $coverage |
||
102 | * @return bool |
||
103 | */ |
||
104 | public function isCoverageLessThan(Coverage $coverage) |
||
108 | |||
109 | /** |
||
110 | * @param Coverage $coverage |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function isCoverageGreaterEqual(Coverage $coverage) |
||
117 | |||
118 | /** |
||
119 | * @param LineRange $lineRange |
||
120 | * @return LineResultCollection |
||
121 | */ |
||
122 | public function selectRange(LineRange $lineRange) |
||
131 | |||
132 | /** |
||
133 | * @param Reflection $reflection |
||
134 | * @return LineResultCollection |
||
135 | */ |
||
136 | public function selectByReflection(Reflection $reflection) |
||
141 | |||
142 | /** |
||
143 | * @param array $analyzeResults |
||
144 | * @return LineResultCollection |
||
145 | */ |
||
146 | public static function from(array $analyzeResults) |
||
156 | |||
157 | /** |
||
158 | * @param callable $filter |
||
159 | * @return \PhpCollection\AbstractSequence |
||
160 | */ |
||
161 | public function selectLines(\Closure $filter) |
||
166 | |||
167 | } |
||
168 |