src/Map.php
public function map(callable $callback): Map
    {
        $apply = function($pair) use ($callback) {
            return $callback($pair->key, $pair->value);
        };

        return new self(array_map($apply, $this->pairs));
    }
public function map(callable $callback): Map
    {
        $apply = function($pair) use ($callback) {
            return $callback($pair->key, $pair->value);
        };

        return new self(array_map($apply, $this->pairs));
    }
public function map ( callable $ callback ) : Map { $ apply = function ( $ pair ) use ( $ callback ) { return $ callback ( $ pair -> key , $ pair -> value ) ; } ; return new self ( array_map ( $ apply , $ this -> pairs ) ) ; }
Returns a new map using the results of applying a callback to each value.

The keys will be equal in both maps.

@param callable $callback Accepts two arguments: key and value, should
return what the updated value will be.

@return Map
Returns a new map using the results of applying a callback to each value .