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