| Total Complexity | 3 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | class GenericCollection extends Data implements ToArrayInterface |
||
| 25 | { |
||
| 26 | use ToArrayTrait; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * |
||
| 30 | * Returns an array of all values for a single field in the collection. |
||
| 31 | * |
||
| 32 | * @param string $field The field name to retrieve values for. |
||
| 33 | * |
||
| 34 | * @return array<int|string, mixed> |
||
| 35 | * |
||
| 36 | */ |
||
| 37 | public function getFieldValues($field) |
||
| 38 | { |
||
| 39 | $values = []; |
||
| 40 | foreach ($this->data as $offset => $entity) { |
||
| 41 | $values[$offset] = $entity->$field; |
||
| 42 | } |
||
| 43 | return $values; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * |
||
| 48 | * Is the collection empty? |
||
| 49 | * |
||
| 50 | * @return bool |
||
| 51 | * |
||
| 52 | */ |
||
| 53 | public function isEmpty() |
||
| 56 | } |
||
| 57 | } |
||
| 58 |