Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 578-587 (lines=10) @@
575
   *
576
   * @return static <p>(Immutable)</p>
577
   */
578
  public function at(\Closure $closure)
579
  {
580
    $array = $this->array;
581
582
    foreach ($array as $key => $value) {
583
      $closure($value, $key);
584
    }
585
586
    return static::create($array);
587
  }
588
589
  /**
590
   * Returns the average value of the current array.
@@ 1165-1174 (lines=10) @@
1162
   *
1163
   * @return static <p>(Immutable)</p>
1164
   */
1165
  public function each(\Closure $closure)
1166
  {
1167
    $array = $this->array;
1168
1169
    foreach ($array as $key => $value) {
1170
      $array[$key] = $closure($value, $key);
1171
    }
1172
1173
    return static::create($array);
1174
  }
1175
1176
  /**
1177
   * Check if a value is in the current array using a closure.
@@ 2818-2829 (lines=12) @@
2815
   *
2816
   * @return static <p>(Immutable)</p>
2817
   */
2818
  public function reject(\Closure $closure)
2819
  {
2820
    $filtered = [];
2821
2822
    foreach ($this->array as $key => $value) {
2823
      if (!$closure($value, $key)) {
2824
        $filtered[$key] = $value;
2825
      }
2826
    }
2827
2828
    return static::create($filtered);
2829
  }
2830
2831
  /**
2832
   * Remove a value from the current array (optional using dot-notation).