public function copy($destination, $destinationContainer = null)
    {
        $this->guardDeletedFile();

        if (is_null($destinationContainer)) {
            $destinationContainer = $this->container();
        }

        $fullDestination = '/'.$destinationContainer.'/'.ltrim($destination, '/');

        $response = $this->api->request('COPY', $this->absolutePath(), [
            'headers' => [
                'Destination' => $fullDestination,
            ],
        ]);

        if ($response->getStatusCode() !== 201) {
            throw new ApiRequestFailedException(
                'Unable to copy file from "'.$this->path().'" to "'.$destination.'".',
                $response->getStatusCode()
            );
        }

        return $fullDestination;
    }
public function copy($destination, $destinationContainer = null)
    {
        $this->guardDeletedFile();

        if (is_null($destinationContainer)) {
            $destinationContainer = $this->container();
        }

        $fullDestination = '/'.$destinationContainer.'/'.ltrim($destination, '/');

        $response = $this->api->request('COPY', $this->absolutePath(), [
            'headers' => [
                'Destination' => $fullDestination,
            ],
        ]);

        if ($response->getStatusCode() !== 201) {
            throw new ApiRequestFailedException(
                'Unable to copy file from "'.$this->path().'" to "'.$destination.'".',
                $response->getStatusCode()
            );
        }

        return $fullDestination;
    }
public function copy ( $ destination , $ destinationContainer = null ) { $ this -> guardDeletedFile ( ) ; if ( is_null ( $ destinationContainer ) ) { $ destinationContainer = $ this -> container ( ) ; } $ fullDestination = '/' . $ destinationContainer . '/' . ltrim ( $ destination , '/' ) ; $ response = $ this -> api -> request ( 'COPY' , $ this -> absolutePath ( ) , [ 'headers' => [ 'Destination' => $ fullDestination , ] , ] ) ; if ( $ response -> getStatusCode ( ) !== 201 ) { throw new ApiRequestFailedException ( 'Unable to copy file from "' . $ this -> path ( ) . '" to "' . $ destination . '".' , $ response -> getStatusCode ( ) ) ; } return $ fullDestination ; }
Copy file to given destination.

@param string $destination
@param string $destinationContainer = null

@throws \LogicException

@return string
Copy file to given destination .