comparison vendor/symfony/console/Descriptor/XmlDescriptor.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
62 $commandXML->setAttribute('name', $command->getName()); 62 $commandXML->setAttribute('name', $command->getName());
63 $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0); 63 $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0);
64 64
65 $commandXML->appendChild($usagesXML = $dom->createElement('usages')); 65 $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
66 66
67 foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) { 67 foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
68 $usagesXML->appendChild($dom->createElement('usage', $usage)); 68 $usagesXML->appendChild($dom->createElement('usage', $usage));
69 } 69 }
70 70
71 $commandXML->appendChild($descriptionXML = $dom->createElement('description')); 71 $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
72 $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription()))); 72 $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
128 } 128 }
129 129
130 /** 130 /**
131 * {@inheritdoc} 131 * {@inheritdoc}
132 */ 132 */
133 protected function describeInputArgument(InputArgument $argument, array $options = array()) 133 protected function describeInputArgument(InputArgument $argument, array $options = [])
134 { 134 {
135 $this->writeDocument($this->getInputArgumentDocument($argument)); 135 $this->writeDocument($this->getInputArgumentDocument($argument));
136 } 136 }
137 137
138 /** 138 /**
139 * {@inheritdoc} 139 * {@inheritdoc}
140 */ 140 */
141 protected function describeInputOption(InputOption $option, array $options = array()) 141 protected function describeInputOption(InputOption $option, array $options = [])
142 { 142 {
143 $this->writeDocument($this->getInputOptionDocument($option)); 143 $this->writeDocument($this->getInputOptionDocument($option));
144 } 144 }
145 145
146 /** 146 /**
147 * {@inheritdoc} 147 * {@inheritdoc}
148 */ 148 */
149 protected function describeInputDefinition(InputDefinition $definition, array $options = array()) 149 protected function describeInputDefinition(InputDefinition $definition, array $options = [])
150 { 150 {
151 $this->writeDocument($this->getInputDefinitionDocument($definition)); 151 $this->writeDocument($this->getInputDefinitionDocument($definition));
152 } 152 }
153 153
154 /** 154 /**
155 * {@inheritdoc} 155 * {@inheritdoc}
156 */ 156 */
157 protected function describeCommand(Command $command, array $options = array()) 157 protected function describeCommand(Command $command, array $options = [])
158 { 158 {
159 $this->writeDocument($this->getCommandDocument($command)); 159 $this->writeDocument($this->getCommandDocument($command));
160 } 160 }
161 161
162 /** 162 /**
163 * {@inheritdoc} 163 * {@inheritdoc}
164 */ 164 */
165 protected function describeApplication(Application $application, array $options = array()) 165 protected function describeApplication(Application $application, array $options = [])
166 { 166 {
167 $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null)); 167 $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
168 } 168 }
169 169
170 /** 170 /**
201 $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0); 201 $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
202 $objectXML->appendChild($descriptionXML = $dom->createElement('description')); 202 $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
203 $descriptionXML->appendChild($dom->createTextNode($argument->getDescription())); 203 $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
204 204
205 $objectXML->appendChild($defaultsXML = $dom->createElement('defaults')); 205 $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
206 $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array())); 206 $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
207 foreach ($defaults as $default) { 207 foreach ($defaults as $default) {
208 $defaultsXML->appendChild($defaultXML = $dom->createElement('default')); 208 $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
209 $defaultXML->appendChild($dom->createTextNode($default)); 209 $defaultXML->appendChild($dom->createTextNode($default));
210 } 210 }
211 211
233 $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0); 233 $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
234 $objectXML->appendChild($descriptionXML = $dom->createElement('description')); 234 $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
235 $descriptionXML->appendChild($dom->createTextNode($option->getDescription())); 235 $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
236 236
237 if ($option->acceptValue()) { 237 if ($option->acceptValue()) {
238 $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array())); 238 $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
239 $objectXML->appendChild($defaultsXML = $dom->createElement('defaults')); 239 $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
240 240
241 if (!empty($defaults)) { 241 if (!empty($defaults)) {
242 foreach ($defaults as $default) { 242 foreach ($defaults as $default) {
243 $defaultsXML->appendChild($defaultXML = $dom->createElement('default')); 243 $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));