function HttpDownloader::addCopy
Create an async copy operation
@phpstan-return PromiseInterface<Http\Response>
Parameters
string $url URL to download:
string $to Path to copy to:
mixed[] $options Stream context options e.g. https://www.php.net/manual/en/context.http.php: although not all options are supported when using the default curl downloader
Return value
Throws
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ HttpDownloader.php, line 173
Class
- HttpDownloader
- @author Jordi Boggiano <j.boggiano@seld.be> @phpstan-type Request array{url: non-empty-string, options: mixed[], copyTo: string|null} @phpstan-type Job array{id: int, status: int, request: Request, sync: bool, origin: string, resolve?: callable,…
Namespace
Composer\UtilCode
public function addCopy(string $url, string $to, array $options = []) {
if ('' === $url) {
throw new \InvalidArgumentException('$url must not be an empty string');
}
[
,
$promise,
] = $this->addJob([
'url' => $url,
'options' => $options,
'copyTo' => $to,
]);
return $promise;
}