| @@ 1440-1450 (lines=11) @@ | ||
| 1437 | * @return static |
|
| 1438 | * <p>(Immutable)</p> |
|
| 1439 | */ |
|
| 1440 | public function each(\Closure $closure): self |
|
| 1441 | { |
|
| 1442 | // init |
|
| 1443 | $array = []; |
|
| 1444 | ||
| 1445 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1446 | $array[$key] = $closure($value, $key); |
|
| 1447 | } |
|
| 1448 | ||
| 1449 | return static::create( |
|
| 1450 | $array, |
|
| 1451 | $this->iteratorClass, |
|
| 1452 | false |
|
| 1453 | ); |
|
| @@ 3232-3243 (lines=12) @@ | ||
| 3229 | * @return static |
|
| 3230 | * <p>(Immutable)</p> |
|
| 3231 | */ |
|
| 3232 | public function reject(\Closure $closure): self |
|
| 3233 | { |
|
| 3234 | // init |
|
| 3235 | $filtered = []; |
|
| 3236 | ||
| 3237 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3238 | if (!$closure($value, $key)) { |
|
| 3239 | $filtered[$key] = $value; |
|
| 3240 | } |
|
| 3241 | } |
|
| 3242 | ||
| 3243 | return static::create( |
|
| 3244 | $filtered, |
|
| 3245 | $this->iteratorClass, |
|
| 3246 | false |
|