@@ 577-586 (lines=10) @@ | ||
574 | * |
|
575 | * @return static <p>(Immutable)</p> |
|
576 | */ |
|
577 | public function at(\Closure $closure) |
|
578 | { |
|
579 | $array = $this->array; |
|
580 | ||
581 | foreach ($array as $key => $value) { |
|
582 | $closure($value, $key); |
|
583 | } |
|
584 | ||
585 | return static::create($array); |
|
586 | } |
|
587 | ||
588 | /** |
|
589 | * Returns the average value of the current array. |
|
@@ 1164-1173 (lines=10) @@ | ||
1161 | * |
|
1162 | * @return static <p>(Immutable)</p> |
|
1163 | */ |
|
1164 | public function each(\Closure $closure) |
|
1165 | { |
|
1166 | $array = $this->array; |
|
1167 | ||
1168 | foreach ($array as $key => $value) { |
|
1169 | $array[$key] = $closure($value, $key); |
|
1170 | } |
|
1171 | ||
1172 | return static::create($array); |
|
1173 | } |
|
1174 | ||
1175 | /** |
|
1176 | * Check if a value is in the current array using a closure. |
|
@@ 2850-2861 (lines=12) @@ | ||
2847 | * |
|
2848 | * @return static <p>(Immutable)</p> |
|
2849 | */ |
|
2850 | public function reject(\Closure $closure) |
|
2851 | { |
|
2852 | $filtered = array(); |
|
2853 | ||
2854 | foreach ($this->array as $key => $value) { |
|
2855 | if (!$closure($value, $key)) { |
|
2856 | $filtered[$key] = $value; |
|
2857 | } |
|
2858 | } |
|
2859 | ||
2860 | return static::create($filtered); |
|
2861 | } |
|
2862 | ||
2863 | /** |
|
2864 | * Remove a value from the current array (optional using dot-notation). |