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.
@@ 577-586 (lines=10) @@
574
   *
575
   * @return Arrayy (Immutable)
576
   */
577
  public function each(\Closure $closure)
578
  {
579
    $array = $this->array;
580
581
    foreach ($array as $key => &$value) {
582
      $value = $closure($value, $key);
583
    }
584
585
    return static::create($array);
586
  }
587
588
  /**
589
   * Check if a value is in the current array using a closure.
@@ 1836-1847 (lines=12) @@
1833
   *
1834
   * @return Arrayy (Immutable)
1835
   */
1836
  public function reject(\Closure $closure)
1837
  {
1838
    $filtered = array();
1839
1840
    foreach ($this->array as $key => $value) {
1841
      if (!$closure($value, $key)) {
1842
        $filtered[$key] = $value;
1843
      }
1844
    }
1845
1846
    return static::create($filtered);
1847
  }
1848
1849
  /**
1850
   * Remove a value from the current array (optional using dot-notation).