| Conditions | 5 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 44 | protected static function errorReport($graphApiCallResult,$errorReportKey) { |
||
| 45 | $totalErrors = 0; |
||
| 46 | |||
| 47 | foreach($graphApiCallResult as $element) { |
||
| 48 | |||
| 49 | if(in_array('sum', $errorReportKey)) { |
||
| 50 | if(in_array($errorReportKey['hidden'], $element)) { |
||
| 51 | continue; |
||
| 52 | } |
||
| 53 | $totalErrors += $element['count']; |
||
| 54 | } |
||
| 55 | |||
| 56 | if(in_array($errorReportKey['show'], $element)) { |
||
| 57 | $totalErrors += $element['count']; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | return $totalErrors; |
||
| 61 | } |
||
| 62 | } |
||
| 63 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: