Code Duplication    Length = 14-14 lines in 4 locations

src/Arrayy.php 4 locations

@@ 3530-3543 (lines=14) @@
3527
     * @psalm-return static<int|TKey,T>
3528
     * @psalm-mutation-free
3529
     */
3530
    public function mergeAppendKeepIndex(array $array = [], bool $recursive = false): self
3531
    {
3532
        if ($recursive === true) {
3533
            $result = \array_replace_recursive($this->toArray(), $array);
3534
        } else {
3535
            $result = \array_replace($this->toArray(), $array);
3536
        }
3537
3538
        return static::create(
3539
            $result,
3540
            $this->iteratorClass,
3541
            false
3542
        );
3543
    }
3544
3545
    /**
3546
     * Merge the new $array into the current array.
@@ 3561-3574 (lines=14) @@
3558
     * @psalm-return static<TKey,T>
3559
     * @psalm-mutation-free
3560
     */
3561
    public function mergeAppendNewIndex(array $array = [], bool $recursive = false): self
3562
    {
3563
        if ($recursive === true) {
3564
            $result = \array_merge_recursive($this->toArray(), $array);
3565
        } else {
3566
            $result = \array_merge($this->toArray(), $array);
3567
        }
3568
3569
        return static::create(
3570
            $result,
3571
            $this->iteratorClass,
3572
            false
3573
        );
3574
    }
3575
3576
    /**
3577
     * Merge the the current array into the $array.
@@ 3591-3604 (lines=14) @@
3588
     * @psalm-return static<TKey,T>
3589
     * @psalm-mutation-free
3590
     */
3591
    public function mergePrependKeepIndex(array $array = [], bool $recursive = false): self
3592
    {
3593
        if ($recursive === true) {
3594
            $result = \array_replace_recursive($array, $this->toArray());
3595
        } else {
3596
            $result = \array_replace($array, $this->toArray());
3597
        }
3598
3599
        return static::create(
3600
            $result,
3601
            $this->iteratorClass,
3602
            false
3603
        );
3604
    }
3605
3606
    /**
3607
     * Merge the current array into the new $array.
@@ 3622-3635 (lines=14) @@
3619
     * @psalm-return static<TKey,T>
3620
     * @psalm-mutation-free
3621
     */
3622
    public function mergePrependNewIndex(array $array = [], bool $recursive = false): self
3623
    {
3624
        if ($recursive === true) {
3625
            $result = \array_merge_recursive($array, $this->toArray());
3626
        } else {
3627
            $result = \array_merge($array, $this->toArray());
3628
        }
3629
3630
        return static::create(
3631
            $result,
3632
            $this->iteratorClass,
3633
            false
3634
        );
3635
    }
3636
3637
    /**
3638
     * @return ArrayyMeta|static