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.
@@ 2010-2021 (lines=12) @@
2007
   *
2008
   * @return Arrayy (Immutable)
2009
   */
2010
  public function reject(\Closure $closure)
2011
  {
2012
    $filtered = array();
2013
2014
    foreach ($this->array as $key => $value) {
2015
      if (!$closure($value, $key)) {
2016
        $filtered[$key] = $value;
2017
      }
2018
    }
2019
2020
    return static::create($filtered);
2021
  }
2022
2023
  /**
2024
   * Remove a value from the current array (optional using dot-notation).