| @@ 2726-2741 (lines=16) @@ | ||
| 2723 | * @psalm-return static<TKey,T> |
|
| 2724 | * @psalm-mutation-free |
|
| 2725 | */ |
|
| 2726 | public function firstsKeys(int $number = null): self |
|
| 2727 | { |
|
| 2728 | $arrayTmp = $this->keys()->toArray(); |
|
| 2729 | ||
| 2730 | if ($number === null) { |
|
| 2731 | $array = (array) \array_shift($arrayTmp); |
|
| 2732 | } else { |
|
| 2733 | $array = \array_splice($arrayTmp, 0, $number); |
|
| 2734 | } |
|
| 2735 | ||
| 2736 | return static::create( |
|
| 2737 | $array, |
|
| 2738 | $this->iteratorClass, |
|
| 2739 | false |
|
| 2740 | ); |
|
| 2741 | } |
|
| 2742 | ||
| 2743 | /** |
|
| 2744 | * Get and remove the first value(s) from the current array. |
|
| @@ 4326-4340 (lines=15) @@ | ||
| 4323 | * @psalm-return static<int|TKey,T> |
|
| 4324 | * @psalm-mutation-free |
|
| 4325 | */ |
|
| 4326 | public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4327 | { |
|
| 4328 | if ($recursive === true) { |
|
| 4329 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4330 | $result = \array_replace_recursive($this->toArray(), $array); |
|
| 4331 | } else { |
|
| 4332 | $result = \array_replace($this->toArray(), $array); |
|
| 4333 | } |
|
| 4334 | ||
| 4335 | return static::create( |
|
| 4336 | $result, |
|
| 4337 | $this->iteratorClass, |
|
| 4338 | false |
|
| 4339 | ); |
|
| 4340 | } |
|
| 4341 | ||
| 4342 | /** |
|
| 4343 | * Merge the new $array into the current array. |
|
| @@ 4368-4382 (lines=15) @@ | ||
| 4365 | * @psalm-return static<int,T> |
|
| 4366 | * @psalm-mutation-free |
|
| 4367 | */ |
|
| 4368 | public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self |
|
| 4369 | { |
|
| 4370 | if ($recursive === true) { |
|
| 4371 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4372 | $result = \array_merge_recursive($this->toArray(), $array); |
|
| 4373 | } else { |
|
| 4374 | $result = \array_merge($this->toArray(), $array); |
|
| 4375 | } |
|
| 4376 | ||
| 4377 | return static::create( |
|
| 4378 | $result, |
|
| 4379 | $this->iteratorClass, |
|
| 4380 | false |
|
| 4381 | ); |
|
| 4382 | } |
|
| 4383 | ||
| 4384 | /** |
|
| 4385 | * Merge the the current array into the $array. |
|
| @@ 4409-4423 (lines=15) @@ | ||
| 4406 | * @psalm-return static<TKey,T> |
|
| 4407 | * @psalm-mutation-free |
|
| 4408 | */ |
|
| 4409 | public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self |
|
| 4410 | { |
|
| 4411 | if ($recursive === true) { |
|
| 4412 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4413 | $result = \array_replace_recursive($array, $this->toArray()); |
|
| 4414 | } else { |
|
| 4415 | $result = \array_replace($array, $this->toArray()); |
|
| 4416 | } |
|
| 4417 | ||
| 4418 | return static::create( |
|
| 4419 | $result, |
|
| 4420 | $this->iteratorClass, |
|
| 4421 | false |
|
| 4422 | ); |
|
| 4423 | } |
|
| 4424 | ||
| 4425 | /** |
|
| 4426 | * Merge the current array into the new $array. |
|
| @@ 4451-4465 (lines=15) @@ | ||
| 4448 | * @psalm-return static<int,T> |
|
| 4449 | * @psalm-mutation-free |
|
| 4450 | */ |
|
| 4451 | public function mergePrependNewIndex(array $array = [], bool $recursive = false): self |
|
| 4452 | { |
|
| 4453 | if ($recursive === true) { |
|
| 4454 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
| 4455 | $result = \array_merge_recursive($array, $this->toArray()); |
|
| 4456 | } else { |
|
| 4457 | $result = \array_merge($array, $this->toArray()); |
|
| 4458 | } |
|
| 4459 | ||
| 4460 | return static::create( |
|
| 4461 | $result, |
|
| 4462 | $this->iteratorClass, |
|
| 4463 | false |
|
| 4464 | ); |
|
| 4465 | } |
|
| 4466 | ||
| 4467 | /** |
|
| 4468 | * @return ArrayyMeta|mixed|static |
|