Code Duplication    Length = 15-16 lines in 2 locations

src/Arrayy.php 2 locations

@@ 489-503 (lines=15) @@
486
   *
487
   * @return static <p>(Immutable) Return an Arrayy object, with the prefixed keys.</p>
488
   */
489
  public function appendToEachKey($prefix)
490
  {
491
    $result = array();
492
    foreach ($this->array as $key => $item) {
493
      if ($item instanceof self) {
494
        $result[$prefix . $key] = $item->appendToEachKey($prefix);
495
      } else if (is_array($item)) {
496
        $result[$prefix . $key] = self::create($item)->appendToEachKey($prefix)->toArray();
497
      } else {
498
        $result[$prefix . $key] = $item;
499
      }
500
    }
501
502
    return self::create($result);
503
  }
504
505
  /**
506
   * Add a prefix to each value.
@@ 2416-2431 (lines=16) @@
2413
   *
2414
   * @return static <p>(Immutable) Return an Arrayy object, with the prepended keys.</p>
2415
   */
2416
  public function prependToEachKey($suffix)
2417
  {
2418
    $result = array();
2419
    foreach ($this->array as $key => $item) {
2420
      if ($item instanceof self) {
2421
        $result[$key] = $item->prependToEachKey($suffix);
2422
      } else if (is_array($item)) {
2423
        $result[$key] = self::create($item)->prependToEachKey($suffix)->toArray();
2424
      } else {
2425
        $result[$key . $suffix] = $item;
2426
      }
2427
2428
    }
2429
2430
    return self::create($result);
2431
  }
2432
2433
  /**
2434
   * Add a suffix to each value.