Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 852-861 (lines=10) @@
849
   *
850
   * @return Arrayy
851
   */
852
  public function each(\Closure $closure)
853
  {
854
    $array = $this->array;
855
856
    foreach ($array as $key => &$value) {
857
      $value = $closure($value, $key);
858
    }
859
860
    return static::create($array);
861
  }
862
863
  /**
864
   * alias: for "Arrayy->getArray()"
@@ 1341-1350 (lines=10) @@
1338
   *
1339
   * @return Arrayy
1340
   */
1341
  public function at(\Closure $closure)
1342
  {
1343
    $array = $this->array;
1344
1345
    foreach ($array as $key => $value) {
1346
      $closure($value, $key);
1347
    }
1348
1349
    return static::create($array);
1350
  }
1351
1352
  /**
1353
   * Merge the new $array into the current array.
@@ 1663-1674 (lines=12) @@
1660
   *
1661
   * @return Arrayy
1662
   */
1663
  public function reject(\Closure $closure)
1664
  {
1665
    $filtered = array();
1666
1667
    foreach ($this->array as $key => $value) {
1668
      if (!$closure($value, $key)) {
1669
        $filtered[$key] = $value;
1670
      }
1671
    }
1672
1673
    return static::create($filtered);
1674
  }
1675
1676
  /**
1677
   * Replace a key with a new key/value pair.