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


PHP PackageInterface::getRepository方法代码示例

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


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

示例1: compareByPriorityPreferInstalled

 public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $ignoreReplace = false)
 {
     if ($a->getRepository() === $b->getRepository()) {
         if (!$ignoreReplace) {
             // return original, not replaced
             if ($this->replaces($a, $b)) {
                 return 1;
                 // use b
             }
             if ($this->replaces($b, $a)) {
                 return -1;
                 // use a
             }
         }
         // priority equal, sort by package id to make reproducible
         if ($a->getId() === $b->getId()) {
             return 0;
         }
         return $a->getId() < $b->getId() ? -1 : 1;
     }
     if (isset($installedMap[$a->getId()])) {
         return -1;
     }
     if (isset($installedMap[$b->getId()])) {
         return 1;
     }
     return $this->getPriority($pool, $a) > $this->getPriority($pool, $b) ? -1 : 1;
 }
开发者ID:natxet,项目名称:composer,代码行数:28,代码来源:DefaultPolicy.php

示例2: initPerforce

 public function initPerforce(PackageInterface $package, $path, $url)
 {
     if (!empty($this->perforce)) {
         $this->perforce->initializePath($path);
         return;
     }
     $repository = $package->getRepository();
     $repoConfig = null;
     if ($repository instanceof VcsRepository) {
         $repoConfig = $this->getRepoConfig($repository);
     }
     $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
 }
开发者ID:neon64,项目名称:composer,代码行数:13,代码来源:PerforceDownloader.php

示例3: doDownload

 /**
  * {@inheritDoc}
  */
 public function doDownload(PackageInterface $package, $path, $url)
 {
     SvnUtil::cleanEnv();
     $ref = $package->getSourceReference();
     $repo = $package->getRepository();
     if ($repo instanceof VcsRepository) {
         $repoConfig = $repo->getRepoConfig();
         if (array_key_exists('svn-cache-credentials', $repoConfig)) {
             $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
         }
     }
     $this->io->writeError("    Checking out " . $package->getSourceReference());
     $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
 }
开发者ID:neon64,项目名称:composer,代码行数:17,代码来源:SvnDownloader.php

示例4: compareByPriorityPreferInstalled

 public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
 {
     if ($a->getRepository() === $b->getRepository()) {
         if ($a->getName() === $b->getName()) {
             $aAliased = $a instanceof AliasPackage;
             $bAliased = $b instanceof AliasPackage;
             if ($aAliased && !$bAliased) {
                 return -1;
             }
             if (!$aAliased && $bAliased) {
                 return 1;
             }
         }
         if (!$ignoreReplace) {
             if ($this->replaces($a, $b)) {
                 return 1;
             }
             if ($this->replaces($b, $a)) {
                 return -1;
             }
             if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
                 $requiredVendor = substr($requiredPackage, 0, $pos);
                 $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
                 $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
                 if ($bIsSameVendor !== $aIsSameVendor) {
                     return $aIsSameVendor ? -1 : 1;
                 }
             }
         }
         if ($a->id === $b->id) {
             return 0;
         }
         return $a->id < $b->id ? -1 : 1;
     }
     if (isset($installedMap[$a->id])) {
         return -1;
     }
     if (isset($installedMap[$b->id])) {
         return 1;
     }
     return $this->getPriority($pool, $a) > $this->getPriority($pool, $b) ? -1 : 1;
 }
开发者ID:VicDeo,项目名称:poc,代码行数:42,代码来源:DefaultPolicy.php

示例5: notifyInstall

 protected function notifyInstall(PackageInterface $package)
 {
     if ($package->getRepository() instanceof NotifiableRepositoryInterface) {
         $package->getRepository()->notifyInstall($package);
     }
 }
开发者ID:nlegoff,项目名称:composer,代码行数:6,代码来源:InstallationManager.php

示例6: compareByPriorityPreferInstalled

 /**
  * @protected
  */
 public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
 {
     if ($a->getRepository() === $b->getRepository()) {
         // prefer aliases to the original package
         if ($a->getName() === $b->getName()) {
             $aAliased = $a instanceof AliasPackage;
             $bAliased = $b instanceof AliasPackage;
             if ($aAliased && !$bAliased) {
                 return -1;
                 // use a
             }
             if (!$aAliased && $bAliased) {
                 return 1;
                 // use b
             }
         }
         if (!$ignoreReplace) {
             // return original, not replaced
             if ($this->replaces($a, $b)) {
                 return 1;
                 // use b
             }
             if ($this->replaces($b, $a)) {
                 return -1;
                 // use a
             }
             // for replacers not replacing each other, put a higher prio on replacing
             // packages with the same vendor as the required package
             if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
                 $requiredVendor = substr($requiredPackage, 0, $pos);
                 $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
                 $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
                 if ($bIsSameVendor !== $aIsSameVendor) {
                     return $aIsSameVendor ? -1 : 1;
                 }
             }
         }
         // priority equal, sort by package id to make reproducible
         if ($a->getId() === $b->getId()) {
             return 0;
         }
         return $a->getId() < $b->getId() ? -1 : 1;
     }
     if (isset($installedMap[$a->getId()])) {
         return -1;
     }
     if (isset($installedMap[$b->getId()])) {
         return 1;
     }
     return $this->getPriority($pool, $a) > $this->getPriority($pool, $b) ? -1 : 1;
 }
开发者ID:aminembarki,项目名称:composer,代码行数:54,代码来源:DefaultPolicy.php

示例7: getRepository

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


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