當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。