| @@ 1387-1397 (lines=11) @@ | ||
| 1384 | * @return static |
|
| 1385 | * <p>(Immutable)</p> |
|
| 1386 | */ |
|
| 1387 | public function each(\Closure $closure): self |
|
| 1388 | { |
|
| 1389 | // init |
|
| 1390 | $array = []; |
|
| 1391 | ||
| 1392 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1393 | $array[$key] = $closure($value, $key); |
|
| 1394 | } |
|
| 1395 | ||
| 1396 | return static::create( |
|
| 1397 | $array, |
|
| 1398 | $this->iteratorClass, |
|
| 1399 | false |
|
| 1400 | ); |
|
| @@ 3098-3109 (lines=12) @@ | ||
| 3095 | * @return static |
|
| 3096 | * <p>(Immutable)</p> |
|
| 3097 | */ |
|
| 3098 | public function reject(\Closure $closure): self |
|
| 3099 | { |
|
| 3100 | // init |
|
| 3101 | $filtered = []; |
|
| 3102 | ||
| 3103 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3104 | if (!$closure($value, $key)) { |
|
| 3105 | $filtered[$key] = $value; |
|
| 3106 | } |
|
| 3107 | } |
|
| 3108 | ||
| 3109 | return static::create( |
|
| 3110 | $filtered, |
|
| 3111 | $this->iteratorClass, |
|
| 3112 | false |
|