| @@ 1346-1356 (lines=11) @@ | ||
| 1343 | * |
|
| 1344 | * @return static <p>(Immutable)</p> |
|
| 1345 | */ |
|
| 1346 | public function each(\Closure $closure) |
|
| 1347 | { |
|
| 1348 | // init |
|
| 1349 | $array = []; |
|
| 1350 | ||
| 1351 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1352 | $array[$key] = $closure($value, $key); |
|
| 1353 | } |
|
| 1354 | ||
| 1355 | return static::create($array, $this->iteratorClass, false); |
|
| 1356 | } |
|
| 1357 | ||
| 1358 | /** |
|
| 1359 | * Check if a value is in the current array using a closure. |
|
| @@ 3122-3133 (lines=12) @@ | ||
| 3119 | * |
|
| 3120 | * @return static <p>(Immutable)</p> |
|
| 3121 | */ |
|
| 3122 | public function reject(\Closure $closure) |
|
| 3123 | { |
|
| 3124 | $filtered = []; |
|
| 3125 | ||
| 3126 | foreach ($this->getGenerator() as $key => $value) { |
|
| 3127 | if (!$closure($value, $key)) { |
|
| 3128 | $filtered[$key] = $value; |
|
| 3129 | } |
|
| 3130 | } |
|
| 3131 | ||
| 3132 | return static::create($filtered, $this->iteratorClass, false); |
|
| 3133 | } |
|
| 3134 | ||
| 3135 | /** |
|
| 3136 | * Remove a value from the current array (optional using dot-notation). |
|