| @@ 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 | ); |
|
| @@ 3174-3185 (lines=12) @@ | ||
| 3171 | * @return static |
|
| 3172 | * <p>(Immutable)</p> |
|
| 3173 | */ |
|
| 3174 | public function reject(\Closure $closure): self |
|
| 3175 | { |
|
| 3176 | // init |
|
| 3177 | $filtered = []; |
|
| 3178 | ||
| 3179 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3180 | if (!$closure($value, $key)) { |
|
| 3181 | $filtered[$key] = $value; |
|
| 3182 | } |
|
| 3183 | } |
|
| 3184 | ||
| 3185 | return static::create( |
|
| 3186 | $filtered, |
|
| 3187 | $this->iteratorClass, |
|
| 3188 | false |
|