Code Duplication    Length = 14-14 lines in 4 locations

src/Arrayy.php 4 locations

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