当前位置: 首页>>代码示例>>PHP>>正文


PHP PackageInterface::setInstallationSource方法代码示例

本文整理汇总了PHP中Composer\Package\PackageInterface::setInstallationSource方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageInterface::setInstallationSource方法的具体用法?PHP PackageInterface::setInstallationSource怎么用?PHP PackageInterface::setInstallationSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Package\PackageInterface的用法示例。


在下文中一共展示了PackageInterface::setInstallationSource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: download

 public function download(PackageInterface $package, $targetDir, $preferSource = null)
 {
     $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
     $sourceType = $package->getSourceType();
     $distType = $package->getDistType();
     if ((!$package->isDev() || $this->preferDist || !$sourceType) && !($preferSource && $sourceType) && $distType) {
         $package->setInstallationSource('dist');
     } elseif ($sourceType) {
         $package->setInstallationSource('source');
     } else {
         throw new \InvalidArgumentException('Package ' . $package . ' must have a source or dist specified');
     }
     $this->filesystem->ensureDirectoryExists($targetDir);
     $downloader = $this->getDownloaderForInstalledPackage($package);
     $downloader->download($package, $targetDir);
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:16,代码来源:DownloadManager.php

示例2: setInstallationSource

 /**
  * {@inheritdoc}
  */
 public function setInstallationSource($type)
 {
     $this->package->setInstallationSource($type);
 }
开发者ID:tenside,项目名称:core,代码行数:7,代码来源:VersionedPackage.php

示例3: setPackageInstallationSource

 /**
  * @param PackageInterface $package
  */
 public function setPackageInstallationSource(PackageInterface $package)
 {
     if (null == $package->getInstallationSource()) {
         $package->setInstallationSource($this->getPackageInstallationSource($package));
     }
 }
开发者ID:letudiant,项目名称:composer-shared-package-plugin,代码行数:9,代码来源:SharedPackageDataManager.php

示例4: setInstallationSource

 public function setInstallationSource($type)
 {
     $this->aliasOf->setInstallationSource($type);
 }
开发者ID:neon64,项目名称:composer,代码行数:4,代码来源:AliasPackage.php

示例5: download

 /**
  * Downloads package into target dir.
  *
  * @param PackageInterface $package      package instance
  * @param string           $targetDir    target dir
  * @param bool             $preferSource prefer installation from source
  *
  * @throws \InvalidArgumentException if package have no urls to download from
  * @throws \RuntimeException
  */
 public function download(PackageInterface $package, $targetDir, $preferSource = null)
 {
     $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
     $sourceType = $package->getSourceType();
     $distType = $package->getDistType();
     $sources = array();
     if ($sourceType) {
         $sources[] = 'source';
     }
     if ($distType) {
         $sources[] = 'dist';
     }
     if (empty($sources)) {
         throw new \InvalidArgumentException('Package ' . $package . ' must have a source or dist specified');
     }
     if ((!$package->isDev() || $this->preferDist) && !$preferSource) {
         $sources = array_reverse($sources);
     }
     $this->filesystem->ensureDirectoryExists($targetDir);
     foreach ($sources as $i => $source) {
         if (isset($e)) {
             $this->io->writeError('    <warning>Now trying to download from ' . $source . '</warning>');
         }
         $package->setInstallationSource($source);
         try {
             $downloader = $this->getDownloaderForInstalledPackage($package);
             if ($downloader) {
                 $downloader->download($package, $targetDir);
             }
             break;
         } catch (\RuntimeException $e) {
             if ($i === count($sources) - 1) {
                 throw $e;
             }
             $this->io->writeError('    <warning>Failed to download ' . $package->getPrettyName() . ' from ' . $source . ': ' . $e->getMessage() . '</warning>');
         }
     }
 }
开发者ID:alancleaver,项目名称:composer,代码行数:48,代码来源:DownloadManager.php

示例6: update

 /**
  * Updates package from initial to target version.
  *
  * @param   PackageInterface    $initial    initial package version
  * @param   PackageInterface    $target     target package version
  * @param   string              $targetDir  target dir
  *
  * @throws  InvalidArgumentException        if initial package is not installed
  */
 public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
 {
     $downloader = $this->getDownloaderForInstalledPackage($initial);
     $installationSource = $initial->getInstallationSource();
     if ('dist' === $installationSource) {
         $initialType = $initial->getDistType();
         $targetType = $target->getDistType();
     } else {
         $initialType = $initial->getSourceType();
         $targetType = $target->getSourceType();
     }
     if ($initialType === $targetType) {
         $target->setInstallationSource($installationSource);
         $downloader->update($initial, $target, $targetDir);
     } else {
         $downloader->remove($initial, $targetDir);
         $this->download($target, $targetDir, 'source' === $installationSource);
     }
 }
开发者ID:natxet,项目名称:composer,代码行数:28,代码来源:DownloadManager.php


注:本文中的Composer\Package\PackageInterface::setInstallationSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。