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.
@@ 2717-2733 (lines=17) @@
2714
   *
2715
   * @return static <p>(Immutable) Return an Arrayy object, with the prepended values.</p>
2716
   */
2717
  public function prependToEachValue($suffix)
2718
  {
2719
    $result = [];
2720
    foreach ($this->array as $key => $item) {
2721
      if ($item instanceof self) {
2722
        $result[$key] = $item->prependToEachValue($suffix);
2723
      } elseif (\is_array($item)) {
2724
        $result[$key] = self::create($item)->prependToEachValue($suffix)->toArray();
2725
      } elseif (\is_object($item)) {
2726
        $result[$key] = $item;
2727
      } else {
2728
        $result[$key] = $item . $suffix;
2729
      }
2730
    }
2731
2732
    return self::create($result);
2733
  }
2734
2735
  /**
2736
   * Push one or more values onto the end of array at once.