Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 239-248 (lines=10) @@
236
   *
237
   * @return Arrayy (Immutable)
238
   */
239
  public function at(\Closure $closure)
240
  {
241
    $array = $this->array;
242
243
    foreach ($array as $key => $value) {
244
      $closure($value, $key);
245
    }
246
247
    return static::create($array);
248
  }
249
250
  /**
251
   * Returns the average value of the current array.
@@ 513-522 (lines=10) @@
510
   *
511
   * @return Arrayy (Immutable)
512
   */
513
  public function each(\Closure $closure)
514
  {
515
    $array = $this->array;
516
517
    foreach ($array as $key => &$value) {
518
      $value = $closure($value, $key);
519
    }
520
521
    return static::create($array);
522
  }
523
524
  /**
525
   * Check if a value is in the current array using a closure.
@@ 1747-1758 (lines=12) @@
1744
   *
1745
   * @return Arrayy (Immutable)
1746
   */
1747
  public function reject(\Closure $closure)
1748
  {
1749
    $filtered = array();
1750
1751
    foreach ($this->array as $key => $value) {
1752
      if (!$closure($value, $key)) {
1753
        $filtered[$key] = $value;
1754
      }
1755
    }
1756
1757
    return static::create($filtered);
1758
  }
1759
1760
  /**
1761
   * Remove a value from the current array (optional using dot-notation).