public function XmlDescriptor::getCommandDocument in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Descriptor/XmlDescriptor.php \Symfony\Component\Console\Descriptor\XmlDescriptor::getCommandDocument()
Parameters
Command $command:
Return value
\DOMDocument
2 calls to XmlDescriptor::getCommandDocument()
- XmlDescriptor::describeCommand in vendor/
symfony/ console/ Descriptor/ XmlDescriptor.php - Describes a Command instance.
- XmlDescriptor::getApplicationDocument in vendor/
symfony/ console/ Descriptor/ XmlDescriptor.php
File
- vendor/
symfony/ console/ Descriptor/ XmlDescriptor.php, line 57
Class
- XmlDescriptor
- XML descriptor.
Namespace
Symfony\Component\Console\DescriptorCode
public function getCommandDocument(Command $command) {
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom
->appendChild($commandXML = $dom
->createElement('command'));
$command
->getSynopsis();
$command
->mergeApplicationDefinition(false);
$commandXML
->setAttribute('id', $command
->getName());
$commandXML
->setAttribute('name', $command
->getName());
$commandXML
->appendChild($usagesXML = $dom
->createElement('usages'));
foreach (array_merge(array(
$command
->getSynopsis(),
), $command
->getAliases(), $command
->getUsages()) as $usage) {
$usagesXML
->appendChild($dom
->createElement('usage', $usage));
}
$commandXML
->appendChild($descriptionXML = $dom
->createElement('description'));
$descriptionXML
->appendChild($dom
->createTextNode(str_replace("\n", "\n ", $command
->getDescription())));
$commandXML
->appendChild($helpXML = $dom
->createElement('help'));
$helpXML
->appendChild($dom
->createTextNode(str_replace("\n", "\n ", $command
->getProcessedHelp())));
$definitionXML = $this
->getInputDefinitionDocument($command
->getNativeDefinition());
$this
->appendDocument($commandXML, $definitionXML
->getElementsByTagName('definition')
->item(0));
return $dom;
}