| @@ 240-249 (lines=10) @@ | ||
| 237 | * |
|
| 238 | * @return Arrayy (Immutable) |
|
| 239 | */ |
|
| 240 | public function at(\Closure $closure) |
|
| 241 | { |
|
| 242 | $array = $this->array; |
|
| 243 | ||
| 244 | foreach ($array as $key => $value) { |
|
| 245 | $closure($value, $key); |
|
| 246 | } |
|
| 247 | ||
| 248 | return static::create($array); |
|
| 249 | } |
|
| 250 | ||
| 251 | /** |
|
| 252 | * Returns the average value of the current array. |
|
| @@ 592-601 (lines=10) @@ | ||
| 589 | * |
|
| 590 | * @return Arrayy (Immutable) |
|
| 591 | */ |
|
| 592 | public function each(\Closure $closure) |
|
| 593 | { |
|
| 594 | $array = $this->array; |
|
| 595 | ||
| 596 | foreach ($array as $key => &$value) { |
|
| 597 | $value = $closure($value, $key); |
|
| 598 | } |
|
| 599 | ||
| 600 | return static::create($array); |
|
| 601 | } |
|
| 602 | ||
| 603 | /** |
|
| 604 | * Check if a value is in the current array using a closure. |
|
| @@ 1868-1879 (lines=12) @@ | ||
| 1865 | * |
|
| 1866 | * @return Arrayy (Immutable) |
|
| 1867 | */ |
|
| 1868 | public function reject(\Closure $closure) |
|
| 1869 | { |
|
| 1870 | $filtered = array(); |
|
| 1871 | ||
| 1872 | foreach ($this->array as $key => $value) { |
|
| 1873 | if (!$closure($value, $key)) { |
|
| 1874 | $filtered[$key] = $value; |
|
| 1875 | } |
|
| 1876 | } |
|
| 1877 | ||
| 1878 | return static::create($filtered); |
|
| 1879 | } |
|
| 1880 | ||
| 1881 | /** |
|
| 1882 | * Remove a value from the current array (optional using dot-notation). |
|