| Total Complexity | 9 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 70% |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | final class ArrayUtils |
||
| 7 | { |
||
| 8 | 2 | public static function isSequential(array $list): bool |
|
| 9 | { |
||
| 10 | 2 | $i = 0; |
|
| 11 | 2 | $count = count($list); |
|
| 12 | 2 | while (isset($list[$i])) { |
|
| 13 | 2 | $i += 1; |
|
| 14 | 2 | if ($i === $count) { |
|
| 15 | 2 | return true; |
|
| 16 | } |
||
| 17 | } |
||
| 18 | |||
| 19 | 2 | return false; |
|
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Recursively merges/replaces array $a and array $b. |
||
| 24 | * |
||
| 25 | * If determined that $b is list, it is appended to $a and the resulting array is made unique |
||
| 26 | * Otherwise values from $b replaces values from $a with the same keys |
||
| 27 | * |
||
| 28 | * @param array $a |
||
| 29 | * @param array $b |
||
| 30 | * @return array |
||
| 31 | */ |
||
| 32 | 2 | public static function merge(array $a, array $b): array |
|
| 54 | } |
||
| 55 | } |
||
| 56 |