Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 512-521 (lines=10) @@
509
   *
510
   * @return static <p>(Immutable)</p>
511
   */
512
  public function at(\Closure $closure)
513
  {
514
    $array = $this->array;
515
516
    foreach ($array as $key => $value) {
517
      $closure($value, $key);
518
    }
519
520
    return static::create($array);
521
  }
522
523
  /**
524
   * Returns the average value of the current array.
@@ 1010-1019 (lines=10) @@
1007
   *
1008
   * @return static <p>(Immutable)</p>
1009
   */
1010
  public function each(\Closure $closure)
1011
  {
1012
    $array = $this->array;
1013
1014
    foreach ($array as $key => $value) {
1015
      $array[$key] = $closure($value, $key);
1016
    }
1017
1018
    return static::create($array);
1019
  }
1020
1021
  /**
1022
   * Check if a value is in the current array using a closure.
@@ 2562-2573 (lines=12) @@
2559
   *
2560
   * @return static <p>(Immutable)</p>
2561
   */
2562
  public function reject(\Closure $closure)
2563
  {
2564
    $filtered = array();
2565
2566
    foreach ($this->array as $key => $value) {
2567
      if (!$closure($value, $key)) {
2568
        $filtered[$key] = $value;
2569
      }
2570
    }
2571
2572
    return static::create($filtered);
2573
  }
2574
2575
  /**
2576
   * Remove a value from the current array (optional using dot-notation).