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


PHP Pool::literalToPrettyString方法代码示例

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


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

示例1: getPrettyString

 public function getPrettyString(Pool $pool, array $installedMap = array())
 {
     $ruleText = '';
     foreach ($this->literals as $i => $literal) {
         if ($i != 0) {
             $ruleText .= '|';
         }
         $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
     }
     switch ($this->reason) {
         case self::RULE_INTERNAL_ALLOW_UPDATE:
             return $ruleText;
         case self::RULE_JOB_INSTALL:
             return "Install command rule ({$ruleText})";
         case self::RULE_JOB_REMOVE:
             return "Remove command rule ({$ruleText})";
         case self::RULE_PACKAGE_CONFLICT:
             $package1 = $pool->literalToPackage($this->literals[0]);
             $package2 = $pool->literalToPackage($this->literals[1]);
             return $package1->getPrettyString() . ' conflicts with ' . $this->formatPackagesUnique($pool, array($package2)) . '.';
         case self::RULE_PACKAGE_REQUIRES:
             $literals = $this->literals;
             $sourceLiteral = array_shift($literals);
             $sourcePackage = $pool->literalToPackage($sourceLiteral);
             $requires = array();
             foreach ($literals as $literal) {
                 $requires[] = $pool->literalToPackage($literal);
             }
             $text = $this->reasonData->getPrettyString($sourcePackage);
             if ($requires) {
                 $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
             } else {
                 $targetName = $this->reasonData->getTarget();
                 // handle php extensions
                 if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
                     if (defined('HHVM_VERSION')) {
                         $text .= ' -> your HHVM version does not satisfy that requirement.';
                     } elseif ($targetName === 'hhvm') {
                         $text .= ' -> you are running this with PHP and not HHVM.';
                     } else {
                         $text .= ' -> your PHP version (' . phpversion() . ') does not satisfy that requirement.';
                     }
                 } elseif (0 === strpos($targetName, 'ext-')) {
                     $ext = substr($targetName, 4);
                     $error = extension_loaded($ext) ? 'has the wrong version (' . (phpversion($ext) ?: '0') . ') installed' : 'is missing from your system';
                     $text .= ' -> the requested PHP extension ' . $ext . ' ' . $error . '.';
                 } elseif (0 === strpos($targetName, 'lib-')) {
                     // handle linked libs
                     $lib = substr($targetName, 4);
                     $text .= ' -> the requested linked library ' . $lib . ' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
                 } else {
                     $text .= ' -> no matching package found.';
                 }
             }
             return $text;
         case self::RULE_PACKAGE_OBSOLETES:
             return $ruleText;
         case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
             return $ruleText;
         case self::RULE_PACKAGE_SAME_NAME:
             return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $this->literals) . '.';
         case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
             return $ruleText;
         case self::RULE_LEARNED:
             return 'Conclusion: ' . $ruleText;
         case self::RULE_PACKAGE_ALIAS:
             return $ruleText;
         default:
             return '(' . $ruleText . ')';
     }
 }
开发者ID:mothership-ec,项目名称:composer,代码行数:71,代码来源:Rule.php


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