| Total Complexity | 2 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class Arrays |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Flatten a multi-dimensional associative array. |
||
| 9 | * |
||
| 10 | * @param array $array |
||
| 11 | * @return array |
||
| 12 | */ |
||
| 13 | 3 | public static function flatten(array $array): array |
|
| 14 | { |
||
| 15 | 3 | return array_merge( |
|
| 16 | 3 | ...array_values($array) |
|
| 17 | 3 | ); |
|
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Takes an associative array and returns a new array without duplicate items. |
||
| 22 | * |
||
| 23 | * @param array $array |
||
| 24 | * @return array |
||
| 25 | */ |
||
| 26 | 2 | public static function unique(array $array, string $field) |
|
| 32 | 2 | ) |
|
| 33 | 2 | ); |
|
| 36 |