@@ 575-584 (lines=10) @@ | ||
572 | * |
|
573 | * @return static <p>(Immutable)</p> |
|
574 | */ |
|
575 | public function at(\Closure $closure) |
|
576 | { |
|
577 | $array = $this->array; |
|
578 | ||
579 | foreach ($array as $key => $value) { |
|
580 | $closure($value, $key); |
|
581 | } |
|
582 | ||
583 | return static::create($array); |
|
584 | } |
|
585 | ||
586 | /** |
|
587 | * Returns the average value of the current array. |
|
@@ 1070-1079 (lines=10) @@ | ||
1067 | * |
|
1068 | * @return static <p>(Immutable)</p> |
|
1069 | */ |
|
1070 | public function each(\Closure $closure) |
|
1071 | { |
|
1072 | $array = $this->array; |
|
1073 | ||
1074 | foreach ($array as $key => $value) { |
|
1075 | $array[$key] = $closure($value, $key); |
|
1076 | } |
|
1077 | ||
1078 | return static::create($array); |
|
1079 | } |
|
1080 | ||
1081 | /** |
|
1082 | * Check if a value is in the current array using a closure. |
|
@@ 2664-2675 (lines=12) @@ | ||
2661 | * |
|
2662 | * @return static <p>(Immutable)</p> |
|
2663 | */ |
|
2664 | public function reject(\Closure $closure) |
|
2665 | { |
|
2666 | $filtered = array(); |
|
2667 | ||
2668 | foreach ($this->array as $key => $value) { |
|
2669 | if (!$closure($value, $key)) { |
|
2670 | $filtered[$key] = $value; |
|
2671 | } |
|
2672 | } |
|
2673 | ||
2674 | return static::create($filtered); |
|
2675 | } |
|
2676 | ||
2677 | /** |
|
2678 | * Remove a value from the current array (optional using dot-notation). |