src/Collection.php
public function transform(callable $callable)
    {
        $ret = new static();

        foreach ($this as $key => $value) {
            $ret->set($key, $callable($value, $key));
        }

        return $ret;
    }
public function transform(callable $callable)
    {
        $ret = new static();

        foreach ($this as $key => $value) {
            $ret->set($key, $callable($value, $key));
        }

        return $ret;
    }
public function transform ( callable $ callable ) { $ ret = new static ( ) ; foreach ( $ this as $ key => $ value ) { $ ret -> set ( $ key , $ callable ( $ value , $ key ) ) ; } return $ ret ; }
Creates a new Collection containing the results of the callable in the same keys

For example: with a collection of the same objects, call a method to export
part of each object into a new collection. Similar to using each() or walk()
except the callable should return the new value for the key.

Note: this method preserves the array keys from the original Collection.

@param callable $callable Receives: $value, $key

@return static
Creates a new Collection containing the results of the callable in the same keys