| Conditions | 3 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 8 | public function __invoke(Collection $collection) |
|
| 19 | { |
||
| 20 | 8 | $acc = null; |
|
| 21 | 8 | $cnt = 0; |
|
| 22 | 8 | foreach ($collection as $element) { |
|
| 23 | 7 | $acc += ObjectFunctions::getPropertyValue($element, $this->fieldName); |
|
| 24 | 6 | $cnt++; |
|
| 25 | } |
||
| 26 | 7 | if (!$cnt) { |
|
| 27 | 1 | return null; |
|
| 28 | } |
||
| 29 | 6 | return $acc / $cnt; |
|
| 30 | } |
||
| 32 |