Code Duplication    Length = 17-17 lines in 2 locations

src/Arrayy.php 2 locations

@@ 536-552 (lines=17) @@
533
   *
534
   * @return static <p>(Immutable) Return an Arrayy object, with the prefixed values.</p>
535
   */
536
  public function appendToEachValue($prefix)
537
  {
538
    $result = [];
539
    foreach ($this->array as $key => $item) {
540
      if ($item instanceof self) {
541
        $result[$key] = $item->appendToEachValue($prefix);
542
      } elseif (\is_array($item)) {
543
        $result[$key] = self::create($item)->appendToEachValue($prefix)->toArray();
544
      } elseif (\is_object($item)) {
545
        $result[$key] = $item;
546
      } else {
547
        $result[$key] = $prefix . $item;
548
      }
549
    }
550
551
    return self::create($result);
552
  }
553
554
  /**
555
   * Convert an array into a object.
@@ 2683-2699 (lines=17) @@
2680
   *
2681
   * @return static <p>(Immutable) Return an Arrayy object, with the prepended values.</p>
2682
   */
2683
  public function prependToEachValue($suffix)
2684
  {
2685
    $result = [];
2686
    foreach ($this->array as $key => $item) {
2687
      if ($item instanceof self) {
2688
        $result[$key] = $item->prependToEachValue($suffix);
2689
      } elseif (\is_array($item)) {
2690
        $result[$key] = self::create($item)->prependToEachValue($suffix)->toArray();
2691
      } elseif (\is_object($item)) {
2692
        $result[$key] = $item;
2693
      } else {
2694
        $result[$key] = $item . $suffix;
2695
      }
2696
    }
2697
2698
    return self::create($result);
2699
  }
2700
2701
  /**
2702
   * Push one or more values onto the end of array at once.