| @@ 1427-1437 (lines=11) @@ | ||
| 1424 | * @return static |
|
| 1425 | * <p>(Immutable)</p> |
|
| 1426 | */ |
|
| 1427 | public function each(\Closure $closure): self |
|
| 1428 | { |
|
| 1429 | // init |
|
| 1430 | $array = []; |
|
| 1431 | ||
| 1432 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1433 | $array[$key] = $closure($value, $key); |
|
| 1434 | } |
|
| 1435 | ||
| 1436 | return static::create( |
|
| 1437 | $array, |
|
| 1438 | $this->iteratorClass, |
|
| 1439 | false |
|
| 1440 | ); |
|
| @@ 3154-3165 (lines=12) @@ | ||
| 3151 | * @return static |
|
| 3152 | * <p>(Immutable)</p> |
|
| 3153 | */ |
|
| 3154 | public function reject(\Closure $closure): self |
|
| 3155 | { |
|
| 3156 | // init |
|
| 3157 | $filtered = []; |
|
| 3158 | ||
| 3159 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3160 | if (!$closure($value, $key)) { |
|
| 3161 | $filtered[$key] = $value; |
|
| 3162 | } |
|
| 3163 | } |
|
| 3164 | ||
| 3165 | return static::create( |
|
| 3166 | $filtered, |
|
| 3167 | $this->iteratorClass, |
|
| 3168 | false |
|