| @@ 307-316 (lines=10) @@ | ||
| 304 | * |
|
| 305 | * @return Arrayy (Immutable) |
|
| 306 | */ |
|
| 307 | public function at(\Closure $closure) |
|
| 308 | { |
|
| 309 | $array = $this->array; |
|
| 310 | ||
| 311 | foreach ($array as $key => $value) { |
|
| 312 | $closure($value, $key); |
|
| 313 | } |
|
| 314 | ||
| 315 | return static::create($array); |
|
| 316 | } |
|
| 317 | ||
| 318 | /** |
|
| 319 | * Returns the average value of the current array. |
|
| @@ 744-753 (lines=10) @@ | ||
| 741 | * |
|
| 742 | * @return Arrayy (Immutable) |
|
| 743 | */ |
|
| 744 | public function each(\Closure $closure) |
|
| 745 | { |
|
| 746 | $array = $this->array; |
|
| 747 | ||
| 748 | foreach ($array as $key => &$value) { |
|
| 749 | $value = $closure($value, $key); |
|
| 750 | } |
|
| 751 | ||
| 752 | return static::create($array); |
|
| 753 | } |
|
| 754 | ||
| 755 | /** |
|
| 756 | * Check if a value is in the current array using a closure. |
|
| @@ 2063-2074 (lines=12) @@ | ||
| 2060 | * |
|
| 2061 | * @return Arrayy (Immutable) |
|
| 2062 | */ |
|
| 2063 | public function reject(\Closure $closure) |
|
| 2064 | { |
|
| 2065 | $filtered = array(); |
|
| 2066 | ||
| 2067 | foreach ($this->array as $key => $value) { |
|
| 2068 | if (!$closure($value, $key)) { |
|
| 2069 | $filtered[$key] = $value; |
|
| 2070 | } |
|
| 2071 | } |
|
| 2072 | ||
| 2073 | return static::create($filtered); |
|
| 2074 | } |
|
| 2075 | ||
| 2076 | /** |
|
| 2077 | * Remove a value from the current array (optional using dot-notation). |
|