Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3.0052 |
Changes | 0 |
1 | <?php |
||
9 | 2 | public static function extractEstimations(array $comments): array |
|
10 | { |
||
11 | 2 | $estimated = 0; |
|
12 | 2 | $spent = 0; |
|
13 | 2 | foreach ($comments as $comment) { |
|
14 | 2 | $text = $comment['data']['text']; |
|
15 | 2 | if (strpos($text, static::PREFIX) === false) { |
|
16 | continue; |
||
17 | } |
||
18 | 2 | $parts = explode('/', $text); |
|
19 | 2 | $spent += (float) array_reverse(explode(' ', $parts[0]))[0]; |
|
20 | 2 | $estimated += (float) $parts[1]; |
|
21 | } |
||
22 | return [ |
||
23 | 2 | 'estimated' => $estimated, |
|
24 | 2 | 'spent' => $spent |
|
25 | ]; |
||
27 | } |