Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

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