| @@ 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. |
|
| @@ 555-564 (lines=10) @@ | ||
| 552 | * |
|
| 553 | * @return Arrayy (Immutable) |
|
| 554 | */ |
|
| 555 | public function each(\Closure $closure) |
|
| 556 | { |
|
| 557 | $array = $this->array; |
|
| 558 | ||
| 559 | foreach ($array as $key => &$value) { |
|
| 560 | $value = $closure($value, $key); |
|
| 561 | } |
|
| 562 | ||
| 563 | return static::create($array); |
|
| 564 | } |
|
| 565 | ||
| 566 | /** |
|
| 567 | * Check if a value is in the current array using a closure. |
|
| @@ 1814-1825 (lines=12) @@ | ||
| 1811 | * |
|
| 1812 | * @return Arrayy (Immutable) |
|
| 1813 | */ |
|
| 1814 | public function reject(\Closure $closure) |
|
| 1815 | { |
|
| 1816 | $filtered = array(); |
|
| 1817 | ||
| 1818 | foreach ($this->array as $key => $value) { |
|
| 1819 | if (!$closure($value, $key)) { |
|
| 1820 | $filtered[$key] = $value; |
|
| 1821 | } |
|
| 1822 | } |
|
| 1823 | ||
| 1824 | return static::create($filtered); |
|
| 1825 | } |
|
| 1826 | ||
| 1827 | /** |
|
| 1828 | * Remove a value from the current array (optional using dot-notation). |
|