PhpBrew\VariantParser::revealCommandArguments PHP Method

revealCommandArguments() public static method

Reveal the variants info to command arguments.
public static revealCommandArguments ( array $info )
$info array
    public static function revealCommandArguments(array $info)
    {
        $out = '';
        foreach ($info['enabled_variants'] as $k => $v) {
            $out .= ' +' . $k;
            if (!is_bool($v)) {
                $out .= '=' . $v . ' ';
            }
        }
        if (!empty($info['disabled_variants'])) {
            $out .= ' -' . implode('-', array_keys($info['disabled_variants']));
        }
        if (!empty($info['extra_options'])) {
            $out .= ' -- ' . implode(' ', $info['extra_options']);
        }
        return $out;
    }

Usage Example

Esempio n. 1
0
 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";
         }
     }
 }
All Usage Examples Of PhpBrew\VariantParser::revealCommandArguments