azure-storage-file/src/File/FileRestProxy.php
public function copyFileAsync(
        $share,
        $path,
        $sourcePath,
        array $metadata = array(),
        FileServiceOptions $options = null
    ) {
        Validate::canCastAsString($share, 'share');
        Validate::canCastAsString($path, 'path');
        Validate::canCastAsString($sourcePath, 'sourcePath');
        Validate::notNullOrEmpty($path, 'path');
        Validate::notNullOrEmpty($share, 'share');
        Validate::notNullOrEmpty($sourcePath, 'sourcePath');

        $method      = Resources::HTTP_PUT;
        $queryParams = array();
        $postParams  = array();
        $path        = $this->createPath($share, $path);

        Utilities::validateMetadata($metadata);
        $headers = $this->generateMetadataHeaders($metadata);

        if (is_null($options)) {
            $options = new FileServiceOptions();
        }

        $this->addOptionalHeader(
            $headers,
            Resources::X_MS_COPY_SOURCE,
            $sourcePath
        );

        $this->addOptionalQueryParam(
            $queryParams,
            Resources::QP_TIMEOUT,
            $options->getTimeout()
        );

        return $this->sendAsync(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            Resources::STATUS_ACCEPTED,
            Resources::EMPTY_STRING,
            $options
        )->then(function ($response) {
            $headers = HttpFormatter::formatHeaders($response->getHeaders());
            return CopyFileResult::create($headers);
        }, null);
    }
public function copyFileAsync(
        $share,
        $path,
        $sourcePath,
        array $metadata = array(),
        FileServiceOptions $options = null
    ) {
        Validate::canCastAsString($share, 'share');
        Validate::canCastAsString($path, 'path');
        Validate::canCastAsString($sourcePath, 'sourcePath');
        Validate::notNullOrEmpty($path, 'path');
        Validate::notNullOrEmpty($share, 'share');
        Validate::notNullOrEmpty($sourcePath, 'sourcePath');

        $method      = Resources::HTTP_PUT;
        $queryParams = array();
        $postParams  = array();
        $path        = $this->createPath($share, $path);

        Utilities::validateMetadata($metadata);
        $headers = $this->generateMetadataHeaders($metadata);

        if (is_null($options)) {
            $options = new FileServiceOptions();
        }

        $this->addOptionalHeader(
            $headers,
            Resources::X_MS_COPY_SOURCE,
            $sourcePath
        );

        $this->addOptionalQueryParam(
            $queryParams,
            Resources::QP_TIMEOUT,
            $options->getTimeout()
        );

        return $this->sendAsync(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            Resources::STATUS_ACCEPTED,
            Resources::EMPTY_STRING,
            $options
        )->then(function ($response) {
            $headers = HttpFormatter::formatHeaders($response->getHeaders());
            return CopyFileResult::create($headers);
        }, null);
    }
Creates promise to inform server to copy file from $sourcePath to $path.

To copy a file to another file within the same storage account, you may
use Shared Key to authenticate the source file. If you are copying a file
from another storage account, or if you are copying a blob from the same
storage account or another storage account, then you must authenticate
the source file or blob using a shared access signature. If the source is
a public blob, no authentication is required to perform the copy
operation.
Here are some examples of source object URLs:
https://myaccount.file.core.windows.net/myshare/mydirectorypath/myfile
https://myaccount.blob.core.windows.net/mycontainer/myblob?sastoken

@param  string                  $share      The share name.
@param  string                  $path       The path of the file.
@param  string                  $sourcePath The path of the source.
@param  array                   $metadata   The metadata of the file.
If specified, source metadata
will not be copied.
@param  FileServiceOptions|null $options    The optional parameters.

@return \GuzzleHttp\Promise\PromiseInterface

@see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-file