@@ 1318-1328 (lines=11) @@ | ||
1315 | * |
|
1316 | * @return static <p>(Immutable)</p> |
|
1317 | */ |
|
1318 | public function each(\Closure $closure) |
|
1319 | { |
|
1320 | // init |
|
1321 | $array = []; |
|
1322 | ||
1323 | foreach ($this->getGenerator() as $key => $value) { |
|
1324 | $array[$key] = $closure($value, $key); |
|
1325 | } |
|
1326 | ||
1327 | return static::create($array); |
|
1328 | } |
|
1329 | ||
1330 | /** |
|
1331 | * Check if a value is in the current array using a closure. |
|
@@ 3070-3081 (lines=12) @@ | ||
3067 | * |
|
3068 | * @return static <p>(Immutable)</p> |
|
3069 | */ |
|
3070 | public function reject(\Closure $closure) |
|
3071 | { |
|
3072 | $filtered = []; |
|
3073 | ||
3074 | foreach ($this->getGenerator() as $key => $value) { |
|
3075 | if (!$closure($value, $key)) { |
|
3076 | $filtered[$key] = $value; |
|
3077 | } |
|
3078 | } |
|
3079 | ||
3080 | return static::create($filtered); |
|
3081 | } |
|
3082 | ||
3083 | /** |
|
3084 | * Remove a value from the current array (optional using dot-notation). |