function VcsDownloader::install
@inheritDoc
Overrides DownloaderInterface::install
File
-
vendor/
composer/ composer/ src/ Composer/ Downloader/ VcsDownloader.php, line 126
Class
- VcsDownloader
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\DownloaderCode
public function install(PackageInterface $package, string $path) : PromiseInterface {
if (!$package->getSourceReference()) {
throw new \InvalidArgumentException('Package ' . $package->getPrettyName() . ' is missing reference information');
}
$this->io
->writeError(" - " . InstallOperation::format($package) . ': ', false);
$urls = $this->prepareUrls($package->getSourceUrls());
while ($url = array_shift($urls)) {
try {
$this->doInstall($package, $path, $url);
break;
} 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);
}