class XmlDescriptor extends Descriptor
{
/**
- * @param InputDefinition $definition
- *
* @return \DOMDocument
*/
public function getInputDefinitionDocument(InputDefinition $definition)
}
/**
- * @param Command $command
- *
* @return \DOMDocument
*/
public function getCommandDocument(Command $command)
$commandXML->setAttribute('id', $command->getName());
$commandXML->setAttribute('name', $command->getName());
+ $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0);
$commandXML->appendChild($usagesXML = $dom->createElement('usages'));
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($rootXml = $dom->createElement('symfony'));
- if ($application->getName() !== 'UNKNOWN') {
+ if ('UNKNOWN' !== $application->getName()) {
$rootXml->setAttribute('name', $application->getName());
- if ($application->getVersion() !== 'UNKNOWN') {
+ if ('UNKNOWN' !== $application->getVersion()) {
$rootXml->setAttribute('version', $application->getVersion());
}
}
$rootXml->appendChild($commandsXML = $dom->createElement('commands'));
- $description = new ApplicationDescription($application, $namespace);
+ $description = new ApplicationDescription($application, $namespace, true);
if ($namespace) {
$commandsXML->setAttribute('namespace', $namespace);
/**
* Appends document children to parent node.
- *
- * @param \DOMNode $parentNode
- * @param \DOMNode $importedParent
*/
private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
{
/**
* Writes DOM document.
*
- * @param \DOMDocument $dom
- *
* @return \DOMDocument|string
*/
private function writeDocument(\DOMDocument $dom)
}
/**
- * @param InputArgument $argument
- *
* @return \DOMDocument
*/
private function getInputArgumentDocument(InputArgument $argument)
}
/**
- * @param InputOption $option
- *
* @return \DOMDocument
*/
private function getInputOptionDocument(InputOption $option)
$pos = strpos($option->getShortcut(), '|');
if (false !== $pos) {
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
- $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
+ $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
} else {
$objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
}