protected function describeApplication(Application $application, array $options = array())
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
$this->write($application->getLongVersion() . "\n" . str_repeat('=', strlen($application->getLongVersion())));
foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$this->write("\n\n");
$this->write('**' . $namespace['id'] . ':**');
}
$this->write("\n\n");
$this->write(implode("\n", array_map(function ($commandName) {
return '* `' . $commandName . '`';
}, $namespace['commands'])));
}
foreach ($description->getCommands() as $command) {
$this->write("\n\n");
$this->write($this->describeCommand($command));
}
}