Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Coverspector |
||
8 | { |
||
9 | private $report; |
||
10 | |||
11 | public function __construct(string $report) |
||
12 | { |
||
13 | $this->report = $report; |
||
14 | } |
||
15 | |||
16 | public function getCoverage(): float |
||
17 | { |
||
18 | $regexp = '/(Classes|Methods|Lines)\:\s+[\d]+\.[\d]+%\s+\(([\d]+)\/([\d]+)\)/m'; |
||
19 | preg_match_all($regexp, $this->report, $matches); |
||
20 | |||
21 | $totals = 0; |
||
22 | foreach ($matches[2] as $index => $metrics) { |
||
23 | $totals += $metrics / $matches[3][$index]; |
||
24 | } |
||
25 | |||
26 | return $totals / count($matches[2]) * 100; |
||
27 | } |
||
28 | |||
29 | public function getUncovered(): array |
||
34 | } |
||
35 | } |
||
36 |