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


PHP Config::getInstalledPhpVersions方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $versions = Config::getInstalledPhpVersions();
     $currentVersion = Config::getCurrentPhpName();
     if (empty($versions)) {
         return $this->logger->notice("Please install at least one PHP with your prefered version.");
     }
     if ($currentVersion === false or !in_array($currentVersion, $versions)) {
         $this->logger->writeln("* (system)");
     }
     foreach ($versions as $version) {
         $versionPrefix = Config::getVersionInstallPrefix($version);
         if ($currentVersion == $version) {
             $this->logger->writeln($this->formatter->format(sprintf('* %-15s', $version), 'bold'));
         } else {
             $this->logger->writeln($this->formatter->format(sprintf('  %-15s', $version), 'bold'));
         }
         if ($this->options->dir) {
             $this->logger->writeln(sprintf("    Prefix:   %s", $versionPrefix));
         }
         // TODO: use Build class to get the variants
         if ($this->options->variants && file_exists($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants')) {
             $info = unserialize(file_get_contents($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants'));
             echo "    Variants: ";
             echo wordwrap(VariantParser::revealCommandArguments($info), 75, " \\\n              ");
             echo "\n";
         }
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:29,代码来源:ListCommand.php

示例2: getVersions

 protected function getVersions()
 {
     $versions = Config::getInstalledPhpVersions();
     return array_map(function ($version) {
         return str_replace('php-', '', $version);
     }, $versions);
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:7,代码来源:EachCommand.php

示例3: execute

 public function execute()
 {
     $versions = Config::getInstalledPhpVersions();
     $currentVersion = Config::getCurrentPhpName();
     // var_dump( $versions );
     echo "Installed versions:\n";
     if ($currentVersion === false or in_array($currentVersion, $versions) === false) {
         echo "* (system)\n";
     }
     foreach ($versions as $version) {
         $versionPrefix = Config::getVersionBuildPrefix($version);
         printf('  %-15s  (%-10s)', $version, $versionPrefix);
         if (file_exists($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants')) {
             $info = unserialize(file_get_contents($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants'));
             echo "\n";
             echo str_repeat(' ', 19);
             echo VariantParser::revealCommandArguments($info);
         }
         echo "\n";
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:21,代码来源:ListCommand.php

示例4: arguments

 public function arguments($args)
 {
     $args->add('installed versions')->validValues(function () {
         return \PhpBrew\Config::getInstalledPhpVersions();
     });
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:6,代码来源:CtagsCommand.php

示例5: assertListContains

 protected function assertListContains($string)
 {
     $this->assertContains($string, Config::getInstalledPhpVersions());
 }
开发者ID:JoeHorn,项目名称:phpbrew,代码行数:4,代码来源:InstallCommandTest.php

示例6: getInheritedVariants

 /**
  * Returns array with the variants for the
  * given version
  * @param  string    $version
  * @throws Exception
  * @return mixed
  */
 public static function getInheritedVariants($version)
 {
     if (!preg_match('/^php-/', $version)) {
         $version = 'php-' . $version;
     }
     $installedVersions = Config::getInstalledPhpVersions();
     if (array_search($version, $installedVersions) === false) {
         throw new Exception("Can't inherit variants from {$version} because this version is not installed!");
     }
     $variantsFile = Config::getVersionBuildPrefix($version) . DIRECTORY_SEPARATOR . 'phpbrew.variants';
     if (!is_readable($variantsFile)) {
         throw new Exception("Can't inherit variant from {$version}!" . "Variants file {$variantsFile} is not readable.");
     }
     return unserialize(file_get_contents($variantsFile));
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:22,代码来源:VariantParser.php


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