Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 832-841 (lines=10) @@
829
   *
830
   * @return Arrayy
831
   */
832
  public function each(\Closure $closure)
833
  {
834
    $array = $this->array;
835
836
    foreach ($array as $key => &$value) {
837
      $value = $closure($value, $key);
838
    }
839
840
    return static::create($array);
841
  }
842
843
  /**
844
   * alias: for "Arrayy->getArray()"
@@ 1321-1330 (lines=10) @@
1318
   *
1319
   * @return Arrayy
1320
   */
1321
  public function at(\Closure $closure)
1322
  {
1323
    $array = $this->array;
1324
1325
    foreach ($array as $key => $value) {
1326
      $closure($value, $key);
1327
    }
1328
1329
    return static::create($array);
1330
  }
1331
1332
  /**
1333
   * Merge the new $array into the current array.
@@ 1643-1654 (lines=12) @@
1640
   *
1641
   * @return Arrayy
1642
   */
1643
  public function reject(\Closure $closure)
1644
  {
1645
    $filtered = array();
1646
1647
    foreach ($this->array as $key => $value) {
1648
      if (!$closure($value, $key)) {
1649
        $filtered[$key] = $value;
1650
      }
1651
    }
1652
1653
    return static::create($filtered);
1654
  }
1655
1656
  /**
1657
   * Replace a key with a new key/value pair.