| @@ 1435-1445 (lines=11) @@ | ||
| 1432 | * @return static |
|
| 1433 | * <p>(Immutable)</p> |
|
| 1434 | */ |
|
| 1435 | public function each(\Closure $closure): self |
|
| 1436 | { |
|
| 1437 | // init |
|
| 1438 | $array = []; |
|
| 1439 | ||
| 1440 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1441 | $array[$key] = $closure($value, $key); |
|
| 1442 | } |
|
| 1443 | ||
| 1444 | return static::create( |
|
| 1445 | $array, |
|
| 1446 | $this->iteratorClass, |
|
| 1447 | false |
|
| 1448 | ); |
|
| @@ 3227-3238 (lines=12) @@ | ||
| 3224 | * @return static |
|
| 3225 | * <p>(Immutable)</p> |
|
| 3226 | */ |
|
| 3227 | public function reject(\Closure $closure): self |
|
| 3228 | { |
|
| 3229 | // init |
|
| 3230 | $filtered = []; |
|
| 3231 | ||
| 3232 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3233 | if (!$closure($value, $key)) { |
|
| 3234 | $filtered[$key] = $value; |
|
| 3235 | } |
|
| 3236 | } |
|
| 3237 | ||
| 3238 | return static::create( |
|
| 3239 | $filtered, |
|
| 3240 | $this->iteratorClass, |
|
| 3241 | false |
|