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.
@@ 555-564 (lines=10) @@
552
   *
553
   * @return Arrayy (Immutable)
554
   */
555
  public function each(\Closure $closure)
556
  {
557
    $array = $this->array;
558
559
    foreach ($array as $key => &$value) {
560
      $value = $closure($value, $key);
561
    }
562
563
    return static::create($array);
564
  }
565
566
  /**
567
   * Check if a value is in the current array using a closure.
@@ 1792-1803 (lines=12) @@
1789
   *
1790
   * @return Arrayy (Immutable)
1791
   */
1792
  public function reject(\Closure $closure)
1793
  {
1794
    $filtered = array();
1795
1796
    foreach ($this->array as $key => $value) {
1797
      if (!$closure($value, $key)) {
1798
        $filtered[$key] = $value;
1799
      }
1800
    }
1801
1802
    return static::create($filtered);
1803
  }
1804
1805
  /**
1806
   * Remove a value from the current array (optional using dot-notation).