public function map($callback, $useKeys = true)
    {
        $keys = $this->keys();

        if ($keys instanceof Collection) {
            $keys = $keys->dump();
        }

        if ($useKeys) {
            $result = array_map($callback, $this->convertArray(clone $this), $keys);
        } else {
            $result = array_map($callback, $this->convertArray(clone $this));
        }

        // Keep keys same as origin
        return $this->bindNewInstance(array_combine($keys, $result));
    }
public function map($callback, $useKeys = true)
    {
        $keys = $this->keys();

        if ($keys instanceof Collection) {
            $keys = $keys->dump();
        }

        if ($useKeys) {
            $result = array_map($callback, $this->convertArray(clone $this), $keys);
        } else {
            $result = array_map($callback, $this->convertArray(clone $this));
        }

        // Keep keys same as origin
        return $this->bindNewInstance(array_combine($keys, $result));
    }
public function map ( $ callback , $ useKeys = true ) { $ keys = $ this -> keys ( ) ; if ( $ keys instanceof Collection ) { $ keys = $ keys -> dump ( ) ; } if ( $ useKeys ) { $ result = array_map ( $ callback , $ this -> convertArray ( clone $ this ) , $ keys ) ; } else { $ result = array_map ( $ callback , $ this -> convertArray ( clone $ this ) ) ; } // Keep keys same as origin return $ this -> bindNewInstance ( array_combine ( $ keys , $ result ) ) ; }
Mapping all elements.

@param callable $callback
@param bool     $useKeys

@return  static  Support chaining.

@since   2.0.9
Mapping all elements .