name: XmlDescriptor
class_comment: "# * XML descriptor.\n# *\n# * @author Jean-Fran\xE7ois Simon <contact@jfsimon.fr>\n\
  # *\n# * @internal"
dependencies:
- name: Application
  type: class
  source: Symfony\Component\Console\Application
- name: Command
  type: class
  source: Symfony\Component\Console\Command\Command
- name: InputArgument
  type: class
  source: Symfony\Component\Console\Input\InputArgument
- name: InputDefinition
  type: class
  source: Symfony\Component\Console\Input\InputDefinition
- name: InputOption
  type: class
  source: Symfony\Component\Console\Input\InputOption
properties: []
methods:
- name: appendDocument
  visibility: private
  parameters:
  - name: parentNode
  - name: importedParent
  comment: "# * XML descriptor.\n# *\n# * @author Jean-Fran\xE7ois Simon <contact@jfsimon.fr>\n\
    # *\n# * @internal\n# */\n# class XmlDescriptor extends Descriptor\n# {\n# public\
    \ function getInputDefinitionDocument(InputDefinition $definition): \\DOMDocument\n\
    # {\n# $dom = new \\DOMDocument('1.0', 'UTF-8');\n# $dom->appendChild($definitionXML\
    \ = $dom->createElement('definition'));\n# \n# $definitionXML->appendChild($argumentsXML\
    \ = $dom->createElement('arguments'));\n# foreach ($definition->getArguments()\
    \ as $argument) {\n# $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));\n\
    # }\n# \n# $definitionXML->appendChild($optionsXML = $dom->createElement('options'));\n\
    # foreach ($definition->getOptions() as $option) {\n# $this->appendDocument($optionsXML,\
    \ $this->getInputOptionDocument($option));\n# }\n# \n# return $dom;\n# }\n# \n\
    # public function getCommandDocument(Command $command, bool $short = false): \\\
    DOMDocument\n# {\n# $dom = new \\DOMDocument('1.0', 'UTF-8');\n# $dom->appendChild($commandXML\
    \ = $dom->createElement('command'));\n# \n# $commandXML->setAttribute('id', $command->getName());\n\
    # $commandXML->setAttribute('name', $command->getName());\n# $commandXML->setAttribute('hidden',\
    \ $command->isHidden() ? 1 : 0);\n# \n# $commandXML->appendChild($usagesXML =\
    \ $dom->createElement('usages'));\n# \n# $commandXML->appendChild($descriptionXML\
    \ = $dom->createElement('description'));\n# $descriptionXML->appendChild($dom->createTextNode(str_replace(\"\
    \\n\", \"\\n \", $command->getDescription())));\n# \n# if ($short) {\n# foreach\
    \ ($command->getAliases() as $usage) {\n# $usagesXML->appendChild($dom->createElement('usage',\
    \ $usage));\n# }\n# } else {\n# $command->mergeApplicationDefinition(false);\n\
    # \n# foreach (array_merge([$command->getSynopsis()], $command->getAliases(),\
    \ $command->getUsages()) as $usage) {\n# $usagesXML->appendChild($dom->createElement('usage',\
    \ $usage));\n# }\n# \n# $commandXML->appendChild($helpXML = $dom->createElement('help'));\n\
    # $helpXML->appendChild($dom->createTextNode(str_replace(\"\\n\", \"\\n \", $command->getProcessedHelp())));\n\
    # \n# $definitionXML = $this->getInputDefinitionDocument($command->getDefinition());\n\
    # $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));\n\
    # }\n# \n# return $dom;\n# }\n# \n# public function getApplicationDocument(Application\
    \ $application, ?string $namespace = null, bool $short = false): \\DOMDocument\n\
    # {\n# $dom = new \\DOMDocument('1.0', 'UTF-8');\n# $dom->appendChild($rootXml\
    \ = $dom->createElement('symfony'));\n# \n# if ('UNKNOWN' !== $application->getName())\
    \ {\n# $rootXml->setAttribute('name', $application->getName());\n# if ('UNKNOWN'\
    \ !== $application->getVersion()) {\n# $rootXml->setAttribute('version', $application->getVersion());\n\
    # }\n# }\n# \n# $rootXml->appendChild($commandsXML = $dom->createElement('commands'));\n\
    # \n# $description = new ApplicationDescription($application, $namespace, true);\n\
    # \n# if ($namespace) {\n# $commandsXML->setAttribute('namespace', $namespace);\n\
    # }\n# \n# foreach ($description->getCommands() as $command) {\n# $this->appendDocument($commandsXML,\
    \ $this->getCommandDocument($command, $short));\n# }\n# \n# if (!$namespace) {\n\
    # $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));\n\
    # \n# foreach ($description->getNamespaces() as $namespaceDescription) {\n# $namespacesXML->appendChild($namespaceArrayXML\
    \ = $dom->createElement('namespace'));\n# $namespaceArrayXML->setAttribute('id',\
    \ $namespaceDescription['id']);\n# \n# foreach ($namespaceDescription['commands']\
    \ as $name) {\n# $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));\n\
    # $commandXML->appendChild($dom->createTextNode($name));\n# }\n# }\n# }\n# \n\
    # return $dom;\n# }\n# \n# protected function describeInputArgument(InputArgument\
    \ $argument, array $options = []): void\n# {\n# $this->writeDocument($this->getInputArgumentDocument($argument));\n\
    # }\n# \n# protected function describeInputOption(InputOption $option, array $options\
    \ = []): void\n# {\n# $this->writeDocument($this->getInputOptionDocument($option));\n\
    # }\n# \n# protected function describeInputDefinition(InputDefinition $definition,\
    \ array $options = []): void\n# {\n# $this->writeDocument($this->getInputDefinitionDocument($definition));\n\
    # }\n# \n# protected function describeCommand(Command $command, array $options\
    \ = []): void\n# {\n# $this->writeDocument($this->getCommandDocument($command,\
    \ $options['short'] ?? false));\n# }\n# \n# protected function describeApplication(Application\
    \ $application, array $options = []): void\n# {\n# $this->writeDocument($this->getApplicationDocument($application,\
    \ $options['namespace'] ?? null, $options['short'] ?? false));\n# }\n# \n# /**\n\
    # * Appends document children to parent node."
- name: writeDocument
  visibility: private
  parameters:
  - name: dom
  comment: '# * Writes DOM document.'
- name: getInputArgumentDocument
  visibility: private
  parameters:
  - name: argument
  comment: null
- name: getInputOptionDocument
  visibility: private
  parameters:
  - name: option
  comment: null
traits:
- Symfony\Component\Console\Application
- Symfony\Component\Console\Command\Command
- Symfony\Component\Console\Input\InputArgument
- Symfony\Component\Console\Input\InputDefinition
- Symfony\Component\Console\Input\InputOption
interfaces: []