Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | 1 | public function render(array $data): string |
|
16 | { |
||
17 | 1 | $result = "Calculating code coverage... "; |
|
18 | 1 | $totalLines = 0; |
|
19 | 1 | $coveredLines = 0; |
|
20 | 1 | foreach ($data as $file) { |
|
21 | 1 | foreach ($file as $line) { |
|
22 | 1 | $totalLines++; |
|
23 | 1 | if ($line > 0) { |
|
24 | 1 | $coveredLines++; |
|
25 | } |
||
26 | } |
||
27 | } |
||
28 | 1 | $coveragePercent = (int) (($coveredLines / $totalLines) * 100); |
|
29 | 1 | $result .= $coveragePercent . "% covered\n"; |
|
30 | 1 | return $result; |
|
31 | } |
||
33 |