Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. VcsDownloader.php

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\Downloader

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal