Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 833-842 (lines=10) @@
830
   *
831
   * @return Arrayy
832
   */
833
  public function each(\Closure $closure)
834
  {
835
    $array = $this->array;
836
837
    foreach ($array as $key => &$value) {
838
      $value = $closure($value, $key);
839
    }
840
841
    return static::create($array);
842
  }
843
844
  /**
845
   * alias: for "Arrayy->getArray()"
@@ 1311-1320 (lines=10) @@
1308
   *
1309
   * @return Arrayy
1310
   */
1311
  public function at(\Closure $closure)
1312
  {
1313
    $array = $this->array;
1314
1315
    foreach ($array as $key => $value) {
1316
      $closure($value, $key);
1317
    }
1318
1319
    return static::create($array);
1320
  }
1321
1322
  /**
1323
   * Merge the new $array into the current array.
@@ 1633-1644 (lines=12) @@
1630
   *
1631
   * @return Arrayy
1632
   */
1633
  public function reject(\Closure $closure)
1634
  {
1635
    $filtered = array();
1636
1637
    foreach ($this->array as $key => $value) {
1638
      if (!$closure($value, $key)) {
1639
        $filtered[$key] = $value;
1640
      }
1641
    }
1642
1643
    return static::create($filtered);
1644
  }
1645
1646
  /**
1647
   * Replace a key with a new key/value pair.