| @@ 1444-1454 (lines=11) @@ | ||
| 1441 | * @return static |
|
| 1442 | * <p>(Immutable)</p> |
|
| 1443 | */ |
|
| 1444 | public function each(\Closure $closure): self |
|
| 1445 | { |
|
| 1446 | // init |
|
| 1447 | $array = []; |
|
| 1448 | ||
| 1449 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1450 | $array[$key] = $closure($value, $key); |
|
| 1451 | } |
|
| 1452 | ||
| 1453 | return static::create( |
|
| 1454 | $array, |
|
| 1455 | $this->iteratorClass, |
|
| 1456 | false |
|
| 1457 | ); |
|
| @@ 3343-3354 (lines=12) @@ | ||
| 3340 | * @return static |
|
| 3341 | * <p>(Immutable)</p> |
|
| 3342 | */ |
|
| 3343 | public function reject(\Closure $closure): self |
|
| 3344 | { |
|
| 3345 | // init |
|
| 3346 | $filtered = []; |
|
| 3347 | ||
| 3348 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3349 | if (!$closure($value, $key)) { |
|
| 3350 | $filtered[$key] = $value; |
|
| 3351 | } |
|
| 3352 | } |
|
| 3353 | ||
| 3354 | return static::create( |
|
| 3355 | $filtered, |
|
| 3356 | $this->iteratorClass, |
|
| 3357 | false |
|