Code Duplication    Length = 17-19 lines in 2 locations

src/Arrayy.php 2 locations

@@ 1066-1084 (lines=19) @@
1063
     * @phpstan-return static<TKey,T>
1064
     * @psalm-mutation-free
1065
     */
1066
    public function appendToEachKey($prefix): self
1067
    {
1068
        // init
1069
        $result = [];
1070
1071
        foreach ($this->getGenerator() as $key => $item) {
1072
            if ($item instanceof self) {
1073
                $result[$prefix . $key] = $item->appendToEachKey($prefix);
1074
            } elseif (\is_array($item)) {
1075
                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
1076
                    ->appendToEachKey($prefix)
1077
                    ->toArray();
1078
            } else {
1079
                $result[$prefix . $key] = $item;
1080
            }
1081
        }
1082
1083
        return self::create(
1084
            $result,
1085
            $this->iteratorClass,
1086
            false
1087
        );
@@ 4967-4983 (lines=17) @@
4964
     * @phpstan-return static<TKey,T>
4965
     * @psalm-mutation-free
4966
     */
4967
    public function prependToEachKey($suffix): self
4968
    {
4969
        // init
4970
        $result = [];
4971
4972
        foreach ($this->getGenerator() as $key => $item) {
4973
            if ($item instanceof self) {
4974
                $result[$key] = $item->prependToEachKey($suffix);
4975
            } elseif (\is_array($item)) {
4976
                $result[$key] = self::create(
4977
                    $item,
4978
                    $this->iteratorClass,
4979
                    false
4980
                )->prependToEachKey($suffix)
4981
                    ->toArray();
4982
            } else {
4983
                $result[$key . $suffix] = $item;
4984
            }
4985
        }
4986