Exemple #1
0
 private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
 {
     $oldSourceRef = $package->getSourceReference();
     if ($package->getSourceUrl() !== $sourceUrl) {
         $package->setSourceType($sourceType);
         $package->setSourceUrl($sourceUrl);
         $package->setSourceReference($sourceReference);
     }
     // only update dist url for github/bitbucket dists as they use a combination of dist url + dist reference to install
     // but for other urls this is ambiguous and could result in bad outcomes
     if (preg_match('{^https?://(?:(?:www\\.)?bitbucket\\.org|(api\\.)?github\\.com)/}i', $distUrl)) {
         $package->setDistUrl($distUrl);
         $this->updateInstallReferences($package, $sourceReference);
     }
     if ($this->updateWhitelist && !$this->isUpdateable($package)) {
         $this->updateInstallReferences($package, $oldSourceRef);
     }
 }