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()"
@@ 1305-1314 (lines=10) @@
1302
   *
1303
   * @return Arrayy
1304
   */
1305
  public function at(\Closure $closure)
1306
  {
1307
    $array = $this->array;
1308
1309
    foreach ($array as $key => $value) {
1310
      $closure($value, $key);
1311
    }
1312
1313
    return static::create($array);
1314
  }
1315
1316
  /**
1317
   * Merge the new $array into the current array.
@@ 1627-1638 (lines=12) @@
1624
   *
1625
   * @return Arrayy
1626
   */
1627
  public function reject(\Closure $closure)
1628
  {
1629
    $filtered = array();
1630
1631
    foreach ($this->array as $key => $value) {
1632
      if (!$closure($value, $key)) {
1633
        $filtered[$key] = $value;
1634
      }
1635
    }
1636
1637
    return static::create($filtered);
1638
  }
1639
1640
  /**
1641
   * Replace a key with a new key/value pair.