Code Duplication    Length = 15-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 491-505 (lines=15) @@
488
   *
489
   * @return static <p>(Immutable) Return an Arrayy object, with the prefixed keys.</p>
490
   */
491
  public function appendToEachKey($prefix)
492
  {
493
    $result = array();
494
    foreach ($this->array as $key => $item) {
495
      if ($item instanceof self) {
496
        $result[$prefix . $key] = $item->appendToEachKey($prefix);
497
      } elseif (\is_array($item)) {
498
        $result[$prefix . $key] = self::create($item)->appendToEachKey($prefix)->toArray();
499
      } else {
500
        $result[$prefix . $key] = $item;
501
      }
502
    }
503
504
    return self::create($result);
505
  }
506
507
  /**
508
   * Add a prefix to each value.
@@ 2602-2617 (lines=16) @@
2599
   *
2600
   * @return static <p>(Immutable) Return an Arrayy object, with the prepended keys.</p>
2601
   */
2602
  public function prependToEachKey($suffix)
2603
  {
2604
    $result = array();
2605
    foreach ($this->array as $key => $item) {
2606
      if ($item instanceof self) {
2607
        $result[$key] = $item->prependToEachKey($suffix);
2608
      } elseif (\is_array($item)) {
2609
        $result[$key] = self::create($item)->prependToEachKey($suffix)->toArray();
2610
      } else {
2611
        $result[$key . $suffix] = $item;
2612
      }
2613
2614
    }
2615
2616
    return self::create($result);
2617
  }
2618
2619
  /**
2620
   * Add a suffix to each value.