| @@ 1320-1330 (lines=11) @@ | ||
| 1317 | * @return static |
|
| 1318 | * <p>(Immutable)</p> |
|
| 1319 | */ |
|
| 1320 | public function each(\Closure $closure) |
|
| 1321 | { |
|
| 1322 | // init |
|
| 1323 | $array = []; |
|
| 1324 | ||
| 1325 | foreach ($this->getGenerator() as $key => $value) { |
|
| 1326 | $array[$key] = $closure($value, $key); |
|
| 1327 | } |
|
| 1328 | ||
| 1329 | return static::create($array, $this->iteratorClass, false); |
|
| 1330 | } |
|
| 1331 | ||
| 1332 | /** |
|
| 1333 | * Check if a value is in the current array using a closure. |
|
| @@ 2850-2861 (lines=12) @@ | ||
| 2847 | * @return static |
|
| 2848 | * <p>(Immutable)</p> |
|
| 2849 | */ |
|
| 2850 | public function reject(\Closure $closure) |
|
| 2851 | { |
|
| 2852 | $filtered = []; |
|
| 2853 | ||
| 2854 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2855 | if (!$closure($value, $key)) { |
|
| 2856 | $filtered[$key] = $value; |
|
| 2857 | } |
|
| 2858 | } |
|
| 2859 | ||
| 2860 | return static::create($filtered, $this->iteratorClass, false); |
|
| 2861 | } |
|
| 2862 | ||
| 2863 | /** |
|
| 2864 | * Remove a value from the current array (optional using dot-notation). |
|