| Total Complexity | 2 | 
| Total Lines | 34 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 8 | class ArrayHelper | ||
| 9 | { | ||
| 10 | /** | ||
| 11 | * Insert the value at the given index and push back values from $index to tail index | ||
| 12 | * | ||
| 13 | * | ||
| 14 | * ### Time/Space complexity | ||
| 15 | * With: | ||
| 16 | * - ๐ equals the provided list length. | ||
| 17 | * - ๐ฅ equals to the number of values to push back (๐ฅ = โฎ๐ โ ๐ท โ $indexโฏ). | ||
| 18 | * | ||
| 19 | * TC: ๐โฎ๐ฅโฏ - Algo will iterate over each and every value to push back | ||
| 20 | * | ||
| 21 | * SC: ๐โฎ๐ทโฏ - Constant extra space | ||
| 22 | * | ||
| 23 | * @param array<mixed> $list โ Must be a 0 indexed list, 0 to n consecutive indexes ! | ||
| 24 | * @phpstan-param list<mixed> $list | ||
| 25 | * @param int $index โ Expected to be between 0 and ๐ ! | ||
| 26 | * @param mixed $value | ||
| 27 | */ | ||
| 28 | 5 | public static function insertAt(array &$list, int $index, mixed $value): void | |
| 44 |