Code Duplication    Length = 15-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 554-568 (lines=15) @@
551
   *
552
   * @return static <p>(Immutable) Return an Arrayy object, with the prefixed keys.</p>
553
   */
554
  public function appendToEachKey($prefix)
555
  {
556
    $result = [];
557
    foreach ($this->array as $key => $item) {
558
      if ($item instanceof self) {
559
        $result[$prefix . $key] = $item->appendToEachKey($prefix);
560
      } elseif (\is_array($item)) {
561
        $result[$prefix . $key] = self::create($item)->appendToEachKey($prefix)->toArray();
562
      } else {
563
        $result[$prefix . $key] = $item;
564
      }
565
    }
566
567
    return self::create($result);
568
  }
569
570
  /**
571
   * Add a prefix to each value.
@@ 2693-2708 (lines=16) @@
2690
   *
2691
   * @return static <p>(Immutable) Return an Arrayy object, with the prepended keys.</p>
2692
   */
2693
  public function prependToEachKey($suffix)
2694
  {
2695
    $result = [];
2696
    foreach ($this->array as $key => $item) {
2697
      if ($item instanceof self) {
2698
        $result[$key] = $item->prependToEachKey($suffix);
2699
      } elseif (\is_array($item)) {
2700
        $result[$key] = self::create($item)->prependToEachKey($suffix)->toArray();
2701
      } else {
2702
        $result[$key . $suffix] = $item;
2703
      }
2704
2705
    }
2706
2707
    return self::create($result);
2708
  }
2709
2710
  /**
2711
   * Add a suffix to each value.