| Total Complexity | 4 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | class ArrayUtils |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Extracts each element of a $multidimensionalArray in a single list. |
||
| 13 | * |
||
| 14 | * @param array<array> $multidimensionalArray |
||
| 15 | * |
||
| 16 | * @return array<Object> |
||
| 17 | */ |
||
| 18 | public function flatten(array $multidimensionalArray): array |
||
| 19 | { |
||
| 20 | return StaticArrayUtils::flatten($multidimensionalArray); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Inserts an element $needle at the $index position in the $haystack, conserving the order and moving other element in the way.\n |
||
| 25 | * Careful, keys will not be preserved. |
||
| 26 | * |
||
| 27 | * @param mixed $needle |
||
| 28 | * @param int $index |
||
| 29 | * @param array<mixed> $haystack |
||
| 30 | * |
||
| 31 | * @return array<mixed> |
||
| 32 | */ |
||
| 33 | public static function insert($needle, int $index, array $haystack): array |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Extracts all $property values from a multidimensional $multidimensionalArray. |
||
| 40 | * |
||
| 41 | * @param array<array> $multidimensionalArray |
||
| 42 | * @param string $property |
||
| 43 | * |
||
| 44 | * @return array<Object> |
||
| 45 | */ |
||
| 46 | public function pluck(array $multidimensionalArray, string $property): array |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Transforms multiple $similarArrays into key-valued arrays. |
||
| 53 | * |
||
| 54 | * @param mixed[] $similarArrays |
||
| 55 | * |
||
| 56 | * @return mixed[] |
||
| 57 | */ |
||
| 58 | public function transpose(array $similarArrays): array |
||
| 63 |