You are here

private function XmlDescriptor::getInputArgumentDocument in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/console/Descriptor/XmlDescriptor.php \Symfony\Component\Console\Descriptor\XmlDescriptor::getInputArgumentDocument()

Parameters

InputArgument $argument:

Return value

\DOMDocument

2 calls to XmlDescriptor::getInputArgumentDocument()
XmlDescriptor::describeInputArgument in vendor/symfony/console/Descriptor/XmlDescriptor.php
Describes an InputArgument instance.
XmlDescriptor::getInputDefinitionDocument in vendor/symfony/console/Descriptor/XmlDescriptor.php

File

vendor/symfony/console/Descriptor/XmlDescriptor.php, line 204

Class

XmlDescriptor
XML descriptor.

Namespace

Symfony\Component\Console\Descriptor

Code

private function getInputArgumentDocument(InputArgument $argument) {
  $dom = new \DOMDocument('1.0', 'UTF-8');
  $dom
    ->appendChild($objectXML = $dom
    ->createElement('argument'));
  $objectXML
    ->setAttribute('name', $argument
    ->getName());
  $objectXML
    ->setAttribute('is_required', $argument
    ->isRequired() ? 1 : 0);
  $objectXML
    ->setAttribute('is_array', $argument
    ->isArray() ? 1 : 0);
  $objectXML
    ->appendChild($descriptionXML = $dom
    ->createElement('description'));
  $descriptionXML
    ->appendChild($dom
    ->createTextNode($argument
    ->getDescription()));
  $objectXML
    ->appendChild($defaultsXML = $dom
    ->createElement('defaults'));
  $defaults = is_array($argument
    ->getDefault()) ? $argument
    ->getDefault() : (is_bool($argument
    ->getDefault()) ? array(
    var_export($argument
      ->getDefault(), true),
  ) : ($argument
    ->getDefault() ? array(
    $argument
      ->getDefault(),
  ) : array()));
  foreach ($defaults as $default) {
    $defaultsXML
      ->appendChild($defaultXML = $dom
      ->createElement('default'));
    $defaultXML
      ->appendChild($dom
      ->createTextNode($default));
  }
  return $dom;
}