Code Duplication    Length = 17-19 lines in 2 locations

src/Arrayy.php 2 locations

@@ 1047-1065 (lines=19) @@
1044
     * @phpstan-return static<TKey,T>
1045
     * @psalm-mutation-free
1046
     */
1047
    public function appendToEachKey($prefix): self
1048
    {
1049
        // init
1050
        $result = [];
1051
1052
        foreach ($this->getGenerator() as $key => $item) {
1053
            if ($item instanceof self) {
1054
                $result[$prefix . $key] = $item->appendToEachKey($prefix);
1055
            } elseif (\is_array($item)) {
1056
                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
1057
                    ->appendToEachKey($prefix)
1058
                    ->toArray();
1059
            } else {
1060
                $result[$prefix . $key] = $item;
1061
            }
1062
        }
1063
1064
        return self::create(
1065
            $result,
1066
            $this->iteratorClass,
1067
            false
1068
        );
@@ 4928-4944 (lines=17) @@
4925
     * @phpstan-return static<TKey,T>
4926
     * @psalm-mutation-free
4927
     */
4928
    public function prependToEachKey($suffix): self
4929
    {
4930
        // init
4931
        $result = [];
4932
4933
        foreach ($this->getGenerator() as $key => $item) {
4934
            if ($item instanceof self) {
4935
                $result[$key] = $item->prependToEachKey($suffix);
4936
            } elseif (\is_array($item)) {
4937
                $result[$key] = self::create(
4938
                    $item,
4939
                    $this->iteratorClass,
4940
                    false
4941
                )->prependToEachKey($suffix)
4942
                    ->toArray();
4943
            } else {
4944
                $result[$key . $suffix] = $item;
4945
            }
4946
        }
4947