Code Duplication    Length = 17-17 lines in 2 locations

src/Arrayy.php 2 locations

@@ 577-593 (lines=17) @@
574
   *
575
   * @return static <p>(Immutable) Return an Arrayy object, with the prefixed values.</p>
576
   */
577
  public function appendToEachValue($prefix)
578
  {
579
    $result = [];
580
    foreach ($this->array as $key => $item) {
581
      if ($item instanceof self) {
582
        $result[$key] = $item->appendToEachValue($prefix);
583
      } elseif (\is_array($item)) {
584
        $result[$key] = self::create($item)->appendToEachValue($prefix)->toArray();
585
      } elseif (\is_object($item)) {
586
        $result[$key] = $item;
587
      } else {
588
        $result[$key] = $prefix . $item;
589
      }
590
    }
591
592
    return self::create($result);
593
  }
594
595
  /**
596
   * Convert an array into a object.
@@ 2723-2739 (lines=17) @@
2720
   *
2721
   * @return static <p>(Immutable) Return an Arrayy object, with the prepended values.</p>
2722
   */
2723
  public function prependToEachValue($suffix)
2724
  {
2725
    $result = [];
2726
    foreach ($this->array as $key => $item) {
2727
      if ($item instanceof self) {
2728
        $result[$key] = $item->prependToEachValue($suffix);
2729
      } elseif (\is_array($item)) {
2730
        $result[$key] = self::create($item)->prependToEachValue($suffix)->toArray();
2731
      } elseif (\is_object($item)) {
2732
        $result[$key] = $item;
2733
      } else {
2734
        $result[$key] = $item . $suffix;
2735
      }
2736
    }
2737
2738
    return self::create($result);
2739
  }
2740
2741
  /**
2742
   * Push one or more values onto the end of array at once.