| @@ 1476-1486 (lines=11) @@ | ||
| 1473 | * @return static |
|
| 1474 | * <p>(Immutable)</p> |
|
| 1475 | */ |
|
| 1476 | public function each(\Closure $closure): self |
|
| 1477 | { |
|
| 1478 | // init |
|
| 1479 | $array = []; |
|
| 1480 | ||
| 1481 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1482 | $array[$key] = $closure($value, $key); |
|
| 1483 | } |
|
| 1484 | ||
| 1485 | return static::create( |
|
| 1486 | $array, |
|
| 1487 | $this->iteratorClass, |
|
| 1488 | false |
|
| 1489 | ); |
|
| @@ 3526-3537 (lines=12) @@ | ||
| 3523 | * @return static |
|
| 3524 | * <p>(Immutable)</p> |
|
| 3525 | */ |
|
| 3526 | public function reject(\Closure $closure): self |
|
| 3527 | { |
|
| 3528 | // init |
|
| 3529 | $filtered = []; |
|
| 3530 | ||
| 3531 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3532 | if (!$closure($value, $key)) { |
|
| 3533 | $filtered[$key] = $value; |
|
| 3534 | } |
|
| 3535 | } |
|
| 3536 | ||
| 3537 | return static::create( |
|
| 3538 | $filtered, |
|
| 3539 | $this->iteratorClass, |
|
| 3540 | false |
|