| @@ 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 | ); |
|
| @@ 3211-3222 (lines=12) @@ | ||
| 3208 | * @return static |
|
| 3209 | * <p>(Immutable)</p> |
|
| 3210 | */ |
|
| 3211 | public function reject(\Closure $closure): self |
|
| 3212 | { |
|
| 3213 | // init |
|
| 3214 | $filtered = []; |
|
| 3215 | ||
| 3216 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3217 | if (!$closure($value, $key)) { |
|
| 3218 | $filtered[$key] = $value; |
|
| 3219 | } |
|
| 3220 | } |
|
| 3221 | ||
| 3222 | return static::create( |
|
| 3223 | $filtered, |
|
| 3224 | $this->iteratorClass, |
|
| 3225 | false |
|