Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 836-845 (lines=10) @@
833
   *
834
   * @return Arrayy
835
   */
836
  public function each(\Closure $closure)
837
  {
838
    $array = $this->array;
839
840
    foreach ($array as $key => &$value) {
841
      $value = $closure($value, $key);
842
    }
843
844
    return static::create($array);
845
  }
846
847
  /**
848
   * alias: for "Arrayy->getArray()"
@@ 1325-1334 (lines=10) @@
1322
   *
1323
   * @return Arrayy
1324
   */
1325
  public function at(\Closure $closure)
1326
  {
1327
    $array = $this->array;
1328
1329
    foreach ($array as $key => $value) {
1330
      $closure($value, $key);
1331
    }
1332
1333
    return static::create($array);
1334
  }
1335
1336
  /**
1337
   * Merge the new $array into the current array.
@@ 1647-1658 (lines=12) @@
1644
   *
1645
   * @return Arrayy
1646
   */
1647
  public function reject(\Closure $closure)
1648
  {
1649
    $filtered = array();
1650
1651
    foreach ($this->array as $key => $value) {
1652
      if (!$closure($value, $key)) {
1653
        $filtered[$key] = $value;
1654
      }
1655
    }
1656
1657
    return static::create($filtered);
1658
  }
1659
1660
  /**
1661
   * Replace a key with a new key/value pair.