getInstalledPhpVersions() public static method

XXX: This method is now deprecated. use findMatchedBuilds insteads.
Deprecation:
public static getInstalledPhpVersions ( )
コード例 #1
0
ファイル: ListCommand.php プロジェクト: WebDevJL/phpbrew
 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";
         }
     }
 }
コード例 #2
0
ファイル: EachCommand.php プロジェクト: WebDevJL/phpbrew
 protected function getVersions()
 {
     $versions = Config::getInstalledPhpVersions();
     return array_map(function ($version) {
         return str_replace('php-', '', $version);
     }, $versions);
 }
コード例 #3
0
ファイル: ListCommand.php プロジェクト: bensb/phpbrew
 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";
     }
 }
コード例 #4
0
ファイル: CtagsCommand.php プロジェクト: phpbrew/phpbrew
 public function arguments($args)
 {
     $args->add('installed versions')->validValues(function () {
         return \PhpBrew\Config::getInstalledPhpVersions();
     });
 }
コード例 #5
0
 protected function assertListContains($string)
 {
     $this->assertContains($string, Config::getInstalledPhpVersions());
 }
コード例 #6
0
ファイル: VariantParser.php プロジェクト: bensb/phpbrew
 /**
  * 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));
 }