| @@ 1560-1570 (lines=11) @@ | ||
| 1557 | * @return static |
|
| 1558 | * <p>(Immutable)</p> |
|
| 1559 | */ |
|
| 1560 | public function each(\Closure $closure): self |
|
| 1561 | { |
|
| 1562 | // init |
|
| 1563 | $array = []; |
|
| 1564 | ||
| 1565 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1566 | $array[$key] = $closure($value, $key); |
|
| 1567 | } |
|
| 1568 | ||
| 1569 | return static::create( |
|
| 1570 | $array, |
|
| 1571 | $this->iteratorClass, |
|
| 1572 | false |
|
| 1573 | ); |
|
| @@ 3843-3854 (lines=12) @@ | ||
| 3840 | * @return static |
|
| 3841 | * <p>(Immutable)</p> |
|
| 3842 | */ |
|
| 3843 | public function reject(\Closure $closure): self |
|
| 3844 | { |
|
| 3845 | // init |
|
| 3846 | $filtered = []; |
|
| 3847 | ||
| 3848 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3849 | if (!$closure($value, $key)) { |
|
| 3850 | $filtered[$key] = $value; |
|
| 3851 | } |
|
| 3852 | } |
|
| 3853 | ||
| 3854 | return static::create( |
|
| 3855 | $filtered, |
|
| 3856 | $this->iteratorClass, |
|
| 3857 | false |
|