@@ 862-869 (lines=8) @@ | ||
859 | * |
|
860 | * @return Map |
|
861 | */ |
|
862 | public function map(callable $callback): Map |
|
863 | { |
|
864 | $apply = function($pair) use ($callback) { |
|
865 | return $callback($pair->key, $pair->value); |
|
866 | }; |
|
867 | ||
868 | return new self(array_map($apply, $this->pairs)); |
|
869 | } |
|
870 | ||
871 | /** |
|
872 | * Returns a sequence of pairs representing all associations. |
@@ 315-322 (lines=8) @@ | ||
312 | * |
|
313 | * @return Map |
|
314 | */ |
|
315 | public function map(callable $callback): Map |
|
316 | { |
|
317 | $apply = function($pair) use ($callback) { |
|
318 | return $callback($pair->key, $pair->value); |
|
319 | }; |
|
320 | ||
321 | return new self(array_map($apply, $this->pairs)); |
|
322 | } |
|
323 | ||
324 | /** |
|
325 | * Returns a sequence of pairs representing all associations. |