當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PackageInterface::getReplaces方法代碼示例

本文整理匯總了PHP中Composer\Package\PackageInterface::getReplaces方法的典型用法代碼示例。如果您正苦於以下問題:PHP PackageInterface::getReplaces方法的具體用法?PHP PackageInterface::getReplaces怎麽用?PHP PackageInterface::getReplaces使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Composer\Package\PackageInterface的用法示例。


在下文中一共展示了PackageInterface::getReplaces方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: enableReplaces

 protected function enableReplaces(PackageInterface $package)
 {
     // we may "replace" any of the packages (e.g. ext-mbstring is bundled with PHP) that have been required
     // figure out which those are so we can decide if they need enabling (because they're built shared)
     $enable = array_intersect_key($package->getReplaces(), $this->allPlatformRequirements);
     foreach (array_keys($enable) as $extension) {
         $this->enableExtension($extension, $package);
     }
 }
開發者ID:Arch1js,項目名稱:Westcombe-Engineering-MRP-system,代碼行數:9,代碼來源:ComposerInstallerPlugin.php

示例2: match

 /**
  * Checks if the package matches the given constraint directly or through
  * provided or replaced packages
  *
  * @param  array|PackageInterface $candidate
  * @param  string                 $name       Name of the package to be matched
  * @param  ConstraintInterface    $constraint The constraint to verify
  * @return int                    One of the MATCH* constants of this class or 0 if there is no match
  */
 private function match($candidate, $name, ConstraintInterface $constraint = null)
 {
     $candidateName = $candidate->getName();
     $candidateVersion = $candidate->getVersion();
     $isDev = $candidate->getStability() === 'dev';
     $isAlias = $candidate instanceof AliasPackage;
     if (!$isDev && !$isAlias && isset($this->filterRequires[$name])) {
         $requireFilter = $this->filterRequires[$name];
     } else {
         $requireFilter = new EmptyConstraint();
     }
     if ($candidateName === $name) {
         $pkgConstraint = new Constraint('==', $candidateVersion);
         if ($constraint === null || $constraint->matches($pkgConstraint)) {
             return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
         }
         return self::MATCH_NAME;
     }
     $provides = $candidate->getProvides();
     $replaces = $candidate->getReplaces();
     // aliases create multiple replaces/provides for one target so they can not use the shortcut below
     if (isset($replaces[0]) || isset($provides[0])) {
         foreach ($provides as $link) {
             if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
                 return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
             }
         }
         foreach ($replaces as $link) {
             if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
                 return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
             }
         }
         return self::MATCH_NONE;
     }
     if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
         return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
     }
     if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
         return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
     }
     return self::MATCH_NONE;
 }
開發者ID:zqcloveping,項目名稱:pagekit,代碼行數:51,代碼來源:Pool.php

示例3: replaces

 /**
  * Checks if source replaces a package with the same name as target.
  *
  * Replace constraints are ignored. This method should only be used for
  * prioritisation, not for actual constraint verification.
  *
  * @param  PackageInterface $source
  * @param  PackageInterface $target
  * @return bool
  */
 protected function replaces(PackageInterface $source, PackageInterface $target)
 {
     foreach ($source->getReplaces() as $link) {
         if ($link->getTarget() === $target->getName()) {
             return true;
         }
     }
     return false;
 }
開發者ID:aminembarki,項目名稱:composer,代碼行數:19,代碼來源:DefaultPolicy.php

示例4: getReplaces

 /**
  * {@inheritdoc}
  */
 public function getReplaces()
 {
     return $this->package->getReplaces();
 }
開發者ID:tenside,項目名稱:core,代碼行數:7,代碼來源:VersionedPackage.php

示例5: getInstallPath

 /**
  * Returns the installation path of a package
  *
  * @param  PackageInterface $package
  * @return string           path
  */
 public function getInstallPath(PackageInterface $package)
 {
     $extensionKey = '';
     foreach ($package->getReplaces() as $packageName => $version) {
         if (strpos($packageName, '/') === FALSE) {
             $extensionKey = trim($packageName);
             break;
         }
     }
     if (empty($extensionKey)) {
         list(, $extensionKey) = explode('/', $package->getName(), 2);
         $extensionKey = str_replace('-', '_', $extensionKey);
     }
     return $this->extensionDir . DIRECTORY_SEPARATOR . $extensionKey;
 }
開發者ID:AOEpeople,項目名稱:CmsComposerInstallers,代碼行數:21,代碼來源:ExtensionInstaller.php


注:本文中的Composer\Package\PackageInterface::getReplaces方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。