| @@ 244-253 (lines=10) @@ | ||
| 241 | * |
|
| 242 | * @return Arrayy (Immutable) |
|
| 243 | */ |
|
| 244 | public function at(\Closure $closure) |
|
| 245 | { |
|
| 246 | $array = $this->array; |
|
| 247 | ||
| 248 | foreach ($array as $key => $value) { |
|
| 249 | $closure($value, $key); |
|
| 250 | } |
|
| 251 | ||
| 252 | return static::create($array); |
|
| 253 | } |
|
| 254 | ||
| 255 | /** |
|
| 256 | * Returns the average value of the current array. |
|
| @@ 634-643 (lines=10) @@ | ||
| 631 | * |
|
| 632 | * @return Arrayy (Immutable) |
|
| 633 | */ |
|
| 634 | public function each(\Closure $closure) |
|
| 635 | { |
|
| 636 | $array = $this->array; |
|
| 637 | ||
| 638 | foreach ($array as $key => &$value) { |
|
| 639 | $value = $closure($value, $key); |
|
| 640 | } |
|
| 641 | ||
| 642 | return static::create($array); |
|
| 643 | } |
|
| 644 | ||
| 645 | /** |
|
| 646 | * Check if a value is in the current array using a closure. |
|
| @@ 1926-1937 (lines=12) @@ | ||
| 1923 | * |
|
| 1924 | * @return Arrayy (Immutable) |
|
| 1925 | */ |
|
| 1926 | public function reject(\Closure $closure) |
|
| 1927 | { |
|
| 1928 | $filtered = array(); |
|
| 1929 | ||
| 1930 | foreach ($this->array as $key => $value) { |
|
| 1931 | if (!$closure($value, $key)) { |
|
| 1932 | $filtered[$key] = $value; |
|
| 1933 | } |
|
| 1934 | } |
|
| 1935 | ||
| 1936 | return static::create($filtered); |
|
| 1937 | } |
|
| 1938 | ||
| 1939 | /** |
|
| 1940 | * Remove a value from the current array (optional using dot-notation). |
|