| @@ 1519-1529 (lines=11) @@ | ||
| 1516 | * @return static |
|
| 1517 | * <p>(Immutable)</p> |
|
| 1518 | */ |
|
| 1519 | public function each(\Closure $closure): self |
|
| 1520 | { |
|
| 1521 | // init |
|
| 1522 | $array = []; |
|
| 1523 | ||
| 1524 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1525 | $array[$key] = $closure($value, $key); |
|
| 1526 | } |
|
| 1527 | ||
| 1528 | return static::create( |
|
| 1529 | $array, |
|
| 1530 | $this->iteratorClass, |
|
| 1531 | false |
|
| 1532 | ); |
|
| @@ 3770-3781 (lines=12) @@ | ||
| 3767 | * @return static |
|
| 3768 | * <p>(Immutable)</p> |
|
| 3769 | */ |
|
| 3770 | public function reject(\Closure $closure): self |
|
| 3771 | { |
|
| 3772 | // init |
|
| 3773 | $filtered = []; |
|
| 3774 | ||
| 3775 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3776 | if (!$closure($value, $key)) { |
|
| 3777 | $filtered[$key] = $value; |
|
| 3778 | } |
|
| 3779 | } |
|
| 3780 | ||
| 3781 | return static::create( |
|
| 3782 | $filtered, |
|
| 3783 | $this->iteratorClass, |
|
| 3784 | false |
|