| @@ 1370-1380 (lines=11) @@ | ||
| 1367 | * |
|
| 1368 | * @return static <p>(Immutable)</p> |
|
| 1369 | */ |
|
| 1370 | public function each(\Closure $closure) |
|
| 1371 | { |
|
| 1372 | // init |
|
| 1373 | $array = []; |
|
| 1374 | ||
| 1375 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1376 | $array[$key] = $closure($value, $key); |
|
| 1377 | } |
|
| 1378 | ||
| 1379 | return static::create($array, $this->iteratorClass, false); |
|
| 1380 | } |
|
| 1381 | ||
| 1382 | /** |
|
| 1383 | * Check if a value is in the current array using a closure. |
|
| @@ 3146-3157 (lines=12) @@ | ||
| 3143 | * |
|
| 3144 | * @return static <p>(Immutable)</p> |
|
| 3145 | */ |
|
| 3146 | public function reject(\Closure $closure) |
|
| 3147 | { |
|
| 3148 | $filtered = []; |
|
| 3149 | ||
| 3150 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3151 | if (!$closure($value, $key)) { |
|
| 3152 | $filtered[$key] = $value; |
|
| 3153 | } |
|
| 3154 | } |
|
| 3155 | ||
| 3156 | return static::create($filtered, $this->iteratorClass, false); |
|
| 3157 | } |
|
| 3158 | ||
| 3159 | /** |
|
| 3160 | * Remove a value from the current array (optional using dot-notation). |
|