Code Duplication    Length = 14-14 lines in 4 locations

src/Arrayy.php 4 locations

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