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.
@@ 2679-2695 (lines=17) @@
2676
   *
2677
   * @return static <p>(Immutable) Return an Arrayy object, with the prepended values.</p>
2678
   */
2679
  public function prependToEachValue($suffix)
2680
  {
2681
    $result = [];
2682
    foreach ($this->array as $key => $item) {
2683
      if ($item instanceof self) {
2684
        $result[$key] = $item->prependToEachValue($suffix);
2685
      } elseif (\is_array($item)) {
2686
        $result[$key] = self::create($item)->prependToEachValue($suffix)->toArray();
2687
      } elseif (\is_object($item)) {
2688
        $result[$key] = $item;
2689
      } else {
2690
        $result[$key] = $item . $suffix;
2691
      }
2692
    }
2693
2694
    return self::create($result);
2695
  }
2696
2697
  /**
2698
   * Push one or more values onto the end of array at once.