src/Collection.php
public function map(\Closure $callback, $context = []): self
    {
        $collection = new static();

        foreach ($this->props as $key => $value) {
            $collection->add($key, $callback($value, $key, $context));
        }

        return $collection;
    }
public function map(\Closure $callback, $context = []): self
    {
        $collection = new static();

        foreach ($this->props as $key => $value) {
            $collection->add($key, $callback($value, $key, $context));
        }

        return $collection;
    }
public function map ( \ Closure $ callback , $ context = [ ] ) : self { $ collection = new static ( ) ; foreach ( $ this -> props as $ key => $ value ) { $ collection -> add ( $ key , $ callback ( $ value , $ key , $ context ) ) ; } return $ collection ; }
map each props item against the callback and return the resulting object
IMMUTABLE

@param array|string $context parameter context to be used inside callback
@return self that already mapped. Return new clone
map each props item against the callback and return the resulting object IMMUTABLE