| @@ 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 | ); |
|
| @@ 3474-3485 (lines=12) @@ | ||
| 3471 | * @return static |
|
| 3472 | * <p>(Immutable)</p> |
|
| 3473 | */ |
|
| 3474 | public function reject(\Closure $closure): self |
|
| 3475 | { |
|
| 3476 | // init |
|
| 3477 | $filtered = []; |
|
| 3478 | ||
| 3479 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3480 | if (!$closure($value, $key)) { |
|
| 3481 | $filtered[$key] = $value; |
|
| 3482 | } |
|
| 3483 | } |
|
| 3484 | ||
| 3485 | return static::create( |
|
| 3486 | $filtered, |
|
| 3487 | $this->iteratorClass, |
|
| 3488 | false |
|