src/Bag.php
public function map(callable $callback)
    {
        $items = [];

        foreach ($this->items as $key => $value) {
            $items[$key] = $callback($key, $value);
        }

        return $this->createFrom($items);
    }
public function map(callable $callback)
    {
        $items = [];

        foreach ($this->items as $key => $value) {
            $items[$key] = $callback($key, $value);
        }

        return $this->createFrom($items);
    }
Applies the `$callable` to each _value_ in the bag and returns
a new bag with the items returned by the function.

Note: This differs from {@see array_map} in that the callback is passed `$key` first, then `$value`.

@param callable $callback Function is passed `($key, $value)`

@return static