| @@ 1484-1494 (lines=11) @@ | ||
| 1481 | * @return static |
|
| 1482 | * <p>(Immutable)</p> |
|
| 1483 | */ |
|
| 1484 | public function each(\Closure $closure): self |
|
| 1485 | { |
|
| 1486 | // init |
|
| 1487 | $array = []; |
|
| 1488 | ||
| 1489 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1490 | $array[$key] = $closure($value, $key); |
|
| 1491 | } |
|
| 1492 | ||
| 1493 | return static::create( |
|
| 1494 | $array, |
|
| 1495 | $this->iteratorClass, |
|
| 1496 | false |
|
| 1497 | ); |
|
| @@ 3534-3545 (lines=12) @@ | ||
| 3531 | * @return static |
|
| 3532 | * <p>(Immutable)</p> |
|
| 3533 | */ |
|
| 3534 | public function reject(\Closure $closure): self |
|
| 3535 | { |
|
| 3536 | // init |
|
| 3537 | $filtered = []; |
|
| 3538 | ||
| 3539 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3540 | if (!$closure($value, $key)) { |
|
| 3541 | $filtered[$key] = $value; |
|
| 3542 | } |
|
| 3543 | } |
|
| 3544 | ||
| 3545 | return static::create( |
|
| 3546 | $filtered, |
|
| 3547 | $this->iteratorClass, |
|
| 3548 | false |
|