| @@ 318-327 (lines=10) @@ | ||
| 315 | * |
|
| 316 | * @return Arrayy (Immutable) |
|
| 317 | */ |
|
| 318 | public function at(\Closure $closure) |
|
| 319 | { |
|
| 320 | $array = $this->array; |
|
| 321 | ||
| 322 | foreach ($array as $key => $value) { |
|
| 323 | $closure($value, $key); |
|
| 324 | } |
|
| 325 | ||
| 326 | return static::create($array); |
|
| 327 | } |
|
| 328 | ||
| 329 | /** |
|
| 330 | * Returns the average value of the current array. |
|
| @@ 755-764 (lines=10) @@ | ||
| 752 | * |
|
| 753 | * @return Arrayy (Immutable) |
|
| 754 | */ |
|
| 755 | public function each(\Closure $closure) |
|
| 756 | { |
|
| 757 | $array = $this->array; |
|
| 758 | ||
| 759 | foreach ($array as $key => &$value) { |
|
| 760 | $value = $closure($value, $key); |
|
| 761 | } |
|
| 762 | ||
| 763 | return static::create($array); |
|
| 764 | } |
|
| 765 | ||
| 766 | /** |
|
| 767 | * Check if a value is in the current array using a closure. |
|
| @@ 2100-2111 (lines=12) @@ | ||
| 2097 | * |
|
| 2098 | * @return Arrayy (Immutable) |
|
| 2099 | */ |
|
| 2100 | public function reject(\Closure $closure) |
|
| 2101 | { |
|
| 2102 | $filtered = array(); |
|
| 2103 | ||
| 2104 | foreach ($this->array as $key => $value) { |
|
| 2105 | if (!$closure($value, $key)) { |
|
| 2106 | $filtered[$key] = $value; |
|
| 2107 | } |
|
| 2108 | } |
|
| 2109 | ||
| 2110 | return static::create($filtered); |
|
| 2111 | } |
|
| 2112 | ||
| 2113 | /** |
|
| 2114 | * Remove a value from the current array (optional using dot-notation). |
|