/** * The command-line arguments and options. * * @return void */ protected function configure() { $this->setName('fetch')->setDescription('Fetches a copy of the latest PHP API Reference from PHP.net. Useful when extending PHP\'s base classes.'); $options = (include __DIR__ . '/fetch_configs.php'); $options = ConfigStore::convert($options); foreach ($options as $option => $details) { list($type, $description, $default) = $details; if (!is_null($default)) { if (is_bool($default)) { $default = $default ? 'true' : 'false'; } $description .= ConsoleUtil::formatters()->gold->apply(' (default: ' . $default . ')'); } $this->addOption($option, null, $type, $description); } }
/** * The command-line arguments and options. * * @return void */ protected function configure() { $this->setName('generate')->setDescription('Generate the documentation output from JSON source definitions.'); $options = (include __DIR__ . '/generate_configs.php'); $options = ConfigStore::convert($options); foreach ($options as $option => $details) { list($type, $description, $default) = $details; if (!is_null($default)) { if (is_bool($default)) { $default = $default ? 'true' : 'false'; } $description .= ConsoleUtil::formatters()->gold->apply(' (default: ' . (is_array($default) ? ParseUtils::unwrapArray($default) : $default) . ')'); } $this->addOption($option, null, $type, $description); } }
/** * The command-line arguments and options. * * @return void */ protected function configure() { $this->setName('parse')->setDescription('Parse the content of the source code and docblocks and produce JSON documents to be used for the project\'s API Reference.'); $options = (include __DIR__ . '/parse_configs.php'); $options = ConfigStore::convert($options); foreach ($options as $option => $details) { list($type, $description, $default) = $details; if (!is_null($default)) { if (is_bool($default)) { $default = $default ? 'true' : 'false'; } $description .= ConsoleUtil::formatters()->gold->apply(' (default: ' . $default . ')'); } $this->addOption($option, null, $type, $description); } }
/** * Return the config values passed to the CLI. * * @param boolean $returnConfigDir Whether or not to return the configuration directory directly. * @return array The config values passed to the CLI. */ private function cliValues($returnConfigDir = false) { $available_configs = (include $this->config_path); $available_configs = array_keys(ConfigStore::convert($available_configs)); $config = array(); foreach ($available_configs as $option) { $config[$option] = $this->input->getOption($option); } $config = array_filter($config); if ($returnConfigDir) { return isset($config['vanity.config_dir']) && file_exists($config['vanity.config_dir']) ? realpath($config['vanity.config_dir']) : null; } if (count($config) > 0) { ConfigStore::$messages[] = 'Merged configuration options from the console.'; } return $config; }