public function downloadPackage(OutputInterface $output, PackageInterface $package) { $source = $package->getSource(); if (!array_key_exists($source->getType(), $this->handlers)) { throw new RuntimeException(sprintf('Unknown source type "%s", cannot download package "%s".', $source->getType(), $package->getName())); } $targetDirectory = $this->getTargetDirectory($package); $this->handlers[$source->getType()]->download($output, $package, $targetDirectory); }
public function download(OutputInterface $output, PackageInterface $package, $path) { $source = $package->getSource(); $gitPath = $path . '/.git'; if (!is_dir($gitPath)) { $this->cloneRepository($source, $path); } $this->checkoutReference($source, $path); }