@@ 495-504 (lines=10) @@ | ||
492 | * |
|
493 | * @return static <p>(Immutable)</p> |
|
494 | */ |
|
495 | public function at(\Closure $closure) |
|
496 | { |
|
497 | $array = $this->array; |
|
498 | ||
499 | foreach ($array as $key => $value) { |
|
500 | $closure($value, $key); |
|
501 | } |
|
502 | ||
503 | return static::create($array); |
|
504 | } |
|
505 | ||
506 | /** |
|
507 | * Returns the average value of the current array. |
|
@@ 962-971 (lines=10) @@ | ||
959 | * |
|
960 | * @return static <p>(Immutable)</p> |
|
961 | */ |
|
962 | public function each(\Closure $closure) |
|
963 | { |
|
964 | $array = $this->array; |
|
965 | ||
966 | foreach ($array as $key => $value) { |
|
967 | $array[$key] = $closure($value, $key); |
|
968 | } |
|
969 | ||
970 | return static::create($array); |
|
971 | } |
|
972 | ||
973 | /** |
|
974 | * Check if a value is in the current array using a closure. |
|
@@ 2392-2403 (lines=12) @@ | ||
2389 | * |
|
2390 | * @return static <p>(Immutable)</p> |
|
2391 | */ |
|
2392 | public function reject(\Closure $closure) |
|
2393 | { |
|
2394 | $filtered = array(); |
|
2395 | ||
2396 | foreach ($this->array as $key => $value) { |
|
2397 | if (!$closure($value, $key)) { |
|
2398 | $filtered[$key] = $value; |
|
2399 | } |
|
2400 | } |
|
2401 | ||
2402 | return static::create($filtered); |
|
2403 | } |
|
2404 | ||
2405 | /** |
|
2406 | * Remove a value from the current array (optional using dot-notation). |