1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50:
<?php
namespace Webmozart\Console\Handler\Help;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
use Webmozart\Console\Adapter\ApplicationAdapter;
use Webmozart\Console\Adapter\CommandAdapter;
use Webmozart\Console\Adapter\IOOutput;
use Webmozart\Console\Api\Args\Args;
use Webmozart\Console\Api\Command\Command;
use Webmozart\Console\Api\IO\IO;
class HelpXmlHandler
{
public function handle(Args $args, IO $io, Command $command)
{
$descriptor = new XmlDescriptor();
$output = new IOOutput($io);
$application = $command->getApplication();
$applicationAdapter = new ApplicationAdapter($application);
if ($args->isArgumentSet('command')) {
$theCommand = $application->getCommand($args->getArgument('command'));
$commandAdapter = new CommandAdapter($theCommand, $applicationAdapter);
$descriptor->describe($output, $commandAdapter);
} else {
$descriptor->describe($output, $applicationAdapter);
}
return 0;
}
}