Code Duplication    Length = 10-12 lines in 3 locations

src/Arrayy.php 3 locations

@@ 615-624 (lines=10) @@
612
   *
613
   * @return Arrayy
614
   */
615
  public function each(\Closure $closure)
616
  {
617
    $array = $this->array;
618
619
    foreach ($array as $key => &$value) {
620
      $value = $closure($value, $key);
621
    }
622
623
    return static::create($array);
624
  }  
625
  
626
  /**
627
   * Returns the value at specified offset.
@@ 1067-1076 (lines=10) @@
1064
   *
1065
   * @return Arrayy
1066
   */
1067
  public function at(\Closure $closure)
1068
  {
1069
    $array = $this->array;
1070
1071
    foreach ($array as $key => $value) {
1072
      $closure($value, $key);
1073
    }
1074
1075
    return static::create($array);
1076
  }
1077
1078
  /**
1079
   * Merge the new $array into the current array.
@@ 1334-1345 (lines=12) @@
1331
   *
1332
   * @return Arrayy
1333
   */
1334
  public function reject(\Closure $closure)
1335
  {
1336
    $filtered = array();
1337
1338
    foreach ($this->array as $key => $value) {
1339
      if (!$closure($value, $key)) {
1340
        $filtered[$key] = $value;
1341
      }
1342
    }
1343
1344
    return static::create($filtered);
1345
  }
1346
1347
  /**
1348
   * Replace a key with a new key/value pair.