@@ 2798-2813 (lines=16) @@ | ||
2795 | * @phpstan-return static<array-key,TKey> |
|
2796 | * @psalm-mutation-free |
|
2797 | */ |
|
2798 | public function firstsKeys(int $number = null): self |
|
2799 | { |
|
2800 | $arrayTmp = $this->keys()->toArray(); |
|
2801 | ||
2802 | if ($number === null) { |
|
2803 | $array = (array) \array_shift($arrayTmp); |
|
2804 | } else { |
|
2805 | $array = \array_splice($arrayTmp, 0, $number); |
|
2806 | } |
|
2807 | ||
2808 | return static::create( |
|
2809 | $array, |
|
2810 | $this->iteratorClass, |
|
2811 | false |
|
2812 | ); |
|
2813 | } |
|
2814 | ||
2815 | /** |
|
2816 | * Get and remove the first value(s) from the current array. |
|
@@ 4425-4439 (lines=15) @@ | ||
4422 | * @phpstan-return static<int|TKey,T> |
|
4423 | * @psalm-mutation-free |
|
4424 | */ |
|
4425 | public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self |
|
4426 | { |
|
4427 | if ($recursive === true) { |
|
4428 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
4429 | $result = \array_replace_recursive($this->toArray(), $array); |
|
4430 | } else { |
|
4431 | $result = \array_replace($this->toArray(), $array); |
|
4432 | } |
|
4433 | ||
4434 | return static::create( |
|
4435 | $result, |
|
4436 | $this->iteratorClass, |
|
4437 | false |
|
4438 | ); |
|
4439 | } |
|
4440 | ||
4441 | /** |
|
4442 | * Merge the new $array into the current array. |
|
@@ 4467-4481 (lines=15) @@ | ||
4464 | * @phpstan-return static<int,T> |
|
4465 | * @psalm-mutation-free |
|
4466 | */ |
|
4467 | public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self |
|
4468 | { |
|
4469 | if ($recursive === true) { |
|
4470 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
4471 | $result = \array_merge_recursive($this->toArray(), $array); |
|
4472 | } else { |
|
4473 | $result = \array_merge($this->toArray(), $array); |
|
4474 | } |
|
4475 | ||
4476 | return static::create( |
|
4477 | $result, |
|
4478 | $this->iteratorClass, |
|
4479 | false |
|
4480 | ); |
|
4481 | } |
|
4482 | ||
4483 | /** |
|
4484 | * Merge the the current array into the $array. |
|
@@ 4508-4522 (lines=15) @@ | ||
4505 | * @phpstan-return static<TKey,T> |
|
4506 | * @psalm-mutation-free |
|
4507 | */ |
|
4508 | public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self |
|
4509 | { |
|
4510 | if ($recursive === true) { |
|
4511 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
4512 | $result = \array_replace_recursive($array, $this->toArray()); |
|
4513 | } else { |
|
4514 | $result = \array_replace($array, $this->toArray()); |
|
4515 | } |
|
4516 | ||
4517 | return static::create( |
|
4518 | $result, |
|
4519 | $this->iteratorClass, |
|
4520 | false |
|
4521 | ); |
|
4522 | } |
|
4523 | ||
4524 | /** |
|
4525 | * Merge the current array into the new $array. |
|
@@ 4550-4564 (lines=15) @@ | ||
4547 | * @phpstan-return static<int,T> |
|
4548 | * @psalm-mutation-free |
|
4549 | */ |
|
4550 | public function mergePrependNewIndex(array $array = [], bool $recursive = false): self |
|
4551 | { |
|
4552 | if ($recursive === true) { |
|
4553 | $array = $this->getArrayRecursiveHelperArrayy($array); |
|
4554 | $result = \array_merge_recursive($array, $this->toArray()); |
|
4555 | } else { |
|
4556 | $result = \array_merge($array, $this->toArray()); |
|
4557 | } |
|
4558 | ||
4559 | return static::create( |
|
4560 | $result, |
|
4561 | $this->iteratorClass, |
|
4562 | false |
|
4563 | ); |
|
4564 | } |
|
4565 | ||
4566 | /** |
|
4567 | * @return ArrayyMeta|mixed|static |