function VcsDownloader::download
@inheritDoc
Overrides DownloaderInterface::download
File
-
vendor/
composer/ composer/ src/ Composer/ Downloader/ VcsDownloader.php, line 63
Class
- VcsDownloader
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\DownloaderCode
public function download(PackageInterface $package, string $path, ?PackageInterface $prevPackage = null) : PromiseInterface {
if (!$package->getSourceReference()) {
throw new \InvalidArgumentException('Package ' . $package->getPrettyName() . ' is missing reference information');
}
$urls = $this->prepareUrls($package->getSourceUrls());
while ($url = array_shift($urls)) {
try {
return $this->doDownload($package, $path, $url, $prevPackage);
} catch (\Exception $e) {
// rethrow phpunit exceptions to avoid hard to debug bug failures
if ($e instanceof \PHPUnit\Framework\Exception) {
throw $e;
}
if ($this->io
->isDebug()) {
$this->io
->writeError('Failed: [' . get_class($e) . '] ' . $e->getMessage());
}
elseif (count($urls)) {
$this->io
->writeError(' Failed, trying the next URL');
}
if (!count($urls)) {
throw $e;
}
}
}
return \React\Promise\resolve(null);
}