public function map(callable $callback): Collection
    {
        $values = [];

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

        return new static($values, $this->type);
    }
public function map(callable $callback): Collection
    {
        $values = [];

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

        return new static($values, $this->type);
    }
public function map ( callable $ callback ) : Collection { $ values = [ ] ; foreach ( $ this -> getInternalValue ( ) as $ key => $ value ) { $ values [ $ key ] = $ callback ( $ value , $ key ) ; } return new static ( $ values , $ this -> type ) ; }
Returns a new collection which is the result of applying a callback to each value of the collection.

The keys and values of the current instance won't be affected.

Callback has the following form:

`mixed callback (mixed $value, mixed key)`

With:
- value: the value of the current iteration
- key: the key of the current iteration

The value returns by the callback must respect type restriction if is set

@param callable $callback

@return Collection
Returns a new collection which is the result of applying a callback to each value of the collection .