| @@ 1444-1454 (lines=11) @@ | ||
| 1441 | * @return static |
|
| 1442 | * <p>(Immutable)</p> |
|
| 1443 | */ |
|
| 1444 | public function each(\Closure $closure): self |
|
| 1445 | { |
|
| 1446 | // init |
|
| 1447 | $array = []; |
|
| 1448 | ||
| 1449 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1450 | $array[$key] = $closure($value, $key); |
|
| 1451 | } |
|
| 1452 | ||
| 1453 | return static::create( |
|
| 1454 | $array, |
|
| 1455 | $this->iteratorClass, |
|
| 1456 | false |
|
| 1457 | ); |
|
| @@ 3413-3424 (lines=12) @@ | ||
| 3410 | * @return static |
|
| 3411 | * <p>(Immutable)</p> |
|
| 3412 | */ |
|
| 3413 | public function reject(\Closure $closure): self |
|
| 3414 | { |
|
| 3415 | // init |
|
| 3416 | $filtered = []; |
|
| 3417 | ||
| 3418 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3419 | if (!$closure($value, $key)) { |
|
| 3420 | $filtered[$key] = $value; |
|
| 3421 | } |
|
| 3422 | } |
|
| 3423 | ||
| 3424 | return static::create( |
|
| 3425 | $filtered, |
|
| 3426 | $this->iteratorClass, |
|
| 3427 | false |
|