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