Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

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