Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 290-299 (lines=10) @@
287
   *
288
   * @return Arrayy (Immutable)
289
   */
290
  public function at(\Closure $closure)
291
  {
292
    $array = $this->array;
293
294
    foreach ($array as $key => $value) {
295
      $closure($value, $key);
296
    }
297
298
    return static::create($array);
299
  }
300
301
  /**
302
   * Returns the average value of the current array.
@@ 723-732 (lines=10) @@
720
   *
721
   * @return Arrayy (Immutable)
722
   */
723
  public function each(\Closure $closure)
724
  {
725
    $array = $this->array;
726
727
    foreach ($array as $key => &$value) {
728
      $value = $closure($value, $key);
729
    }
730
731
    return static::create($array);
732
  }
733
734
  /**
735
   * Check if a value is in the current array using a closure.
@@ 2013-2024 (lines=12) @@
2010
   *
2011
   * @return Arrayy (Immutable)
2012
   */
2013
  public function reject(\Closure $closure)
2014
  {
2015
    $filtered = array();
2016
2017
    foreach ($this->array as $key => $value) {
2018
      if (!$closure($value, $key)) {
2019
        $filtered[$key] = $value;
2020
      }
2021
    }
2022
2023
    return static::create($filtered);
2024
  }
2025
2026
  /**
2027
   * Remove a value from the current array (optional using dot-notation).