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


PHP PackageInterface::getSourceUrls方法代码示例

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


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

示例1: update

 /**
  * {@inheritDoc}
  */
 public function update(PackageInterface $initial, PackageInterface $target, $path)
 {
     if (!$target->getSourceReference()) {
         throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
     }
     $name = $target->getName();
     if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
         $from = $initial->getSourceReference();
         $to = $target->getSourceReference();
         $name .= ' ' . $initial->getPrettyVersion();
     } else {
         $from = $initial->getFullPrettyVersion();
         $to = $target->getFullPrettyVersion();
     }
     $this->io->writeError("  - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
     $urls = $target->getSourceUrls();
     while ($url = array_shift($urls)) {
         try {
             if (Filesystem::isLocalPath($url)) {
                 $url = realpath($url);
             }
             $this->doUpdate($initial, $target, $path, $url);
             break;
         } catch (\Exception $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');
             } else {
                 throw $e;
             }
         }
     }
     $this->io->writeError('');
 }
开发者ID:linearsoft,项目名称:composer-svn-export,代码行数:38,代码来源:Downloader.php

示例2: update

 /**
  * {@inheritDoc}
  */
 public function update(PackageInterface $initial, PackageInterface $target, $path)
 {
     if (!$target->getSourceReference()) {
         throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
     }
     $name = $target->getName();
     if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
         if ($target->getSourceType() === 'svn') {
             $from = $initial->getSourceReference();
             $to = $target->getSourceReference();
         } else {
             $from = substr($initial->getSourceReference(), 0, 7);
             $to = substr($target->getSourceReference(), 0, 7);
         }
         $name .= ' ' . $initial->getPrettyVersion();
     } else {
         $from = $initial->getFullPrettyVersion();
         $to = $target->getFullPrettyVersion();
     }
     $this->io->writeError("  - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
     $this->cleanChanges($initial, $path, true);
     $urls = $target->getSourceUrls();
     $exception = null;
     while ($url = array_shift($urls)) {
         try {
             if (Filesystem::isLocalPath($url)) {
                 $url = realpath($url);
             }
             $this->doUpdate($initial, $target, $path, $url);
             $exception = null;
             break;
         } catch (\Exception $exception) {
             // rethrow phpunit exceptions to avoid hard to debug bug failures
             if ($exception instanceof \PHPUnit_Framework_Exception) {
                 throw $exception;
             }
             if ($this->io->isDebug()) {
                 $this->io->writeError('Failed: [' . get_class($exception) . '] ' . $exception->getMessage());
             } elseif (count($urls)) {
                 $this->io->writeError('    Failed, trying the next URL');
             }
         }
     }
     $this->reapplyChanges($path);
     // print the commit logs if in verbose mode and VCS metadata is present
     // because in case of missing metadata code would trigger another exception
     if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
         $message = 'Pulling in changes:';
         $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
         if (!trim($logs)) {
             $message = 'Rolling back changes:';
             $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
         }
         if (trim($logs)) {
             $logs = implode("\n", array_map(function ($line) {
                 return '      ' . $line;
             }, explode("\n", $logs)));
             // escape angle brackets for proper output in the console
             $logs = str_replace('<', '\\<', $logs);
             $this->io->writeError('    ' . $message);
             $this->io->writeError($logs);
         }
     }
     if (!$urls && $exception) {
         throw $exception;
     }
     $this->io->writeError('');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:71,代码来源:VcsDownloader.php

示例3: getSourceUrls

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

示例4: update

 /**
  * {@inheritDoc}
  */
 public function update(PackageInterface $initial, PackageInterface $target, $path)
 {
     if (!$target->getSourceReference()) {
         throw new \InvalidArgumentException('Package ' . $target->getPrettyName() . ' is missing reference information');
     }
     $name = $target->getName();
     if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
         if ($target->getSourceType() === 'svn') {
             $from = $initial->getSourceReference();
             $to = $target->getSourceReference();
         } else {
             $from = substr($initial->getSourceReference(), 0, 7);
             $to = substr($target->getSourceReference(), 0, 7);
         }
         $name .= ' ' . $initial->getPrettyVersion();
     } else {
         $from = $initial->getFullPrettyVersion();
         $to = $target->getFullPrettyVersion();
     }
     $this->io->writeError("  - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
     $this->cleanChanges($initial, $path, true);
     $urls = $target->getSourceUrls();
     while ($url = array_shift($urls)) {
         try {
             if (Filesystem::isLocalPath($url)) {
                 $url = realpath($url);
             }
             $this->doUpdate($initial, $target, $path, $url);
             break;
         } catch (\Exception $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');
             } else {
                 // in case of failed update, try to reapply the changes before aborting
                 $this->reapplyChanges($path);
                 throw $e;
             }
         }
     }
     $this->reapplyChanges($path);
     // print the commit logs if in verbose mode
     if ($this->io->isVerbose()) {
         $message = 'Pulling in changes:';
         $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
         if (!trim($logs)) {
             $message = 'Rolling back changes:';
             $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
         }
         if (trim($logs)) {
             $logs = implode("\n", array_map(function ($line) {
                 return '      ' . $line;
             }, explode("\n", $logs)));
             // escape angle brackets for proper output in the console
             $logs = str_replace('<', '\\<', $logs);
             $this->io->writeError('    ' . $message);
             $this->io->writeError($logs);
         }
     }
     $this->io->writeError('');
 }
开发者ID:alancleaver,项目名称:composer,代码行数:65,代码来源:VcsDownloader.php

示例5: getSourceUrls

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


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