comparison vendor/symfony/console/Input/ArgvInput.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
260 /** 260 /**
261 * {@inheritdoc} 261 * {@inheritdoc}
262 */ 262 */
263 public function getFirstArgument() 263 public function getFirstArgument()
264 { 264 {
265 foreach ($this->tokens as $token) { 265 $isOption = false;
266 foreach ($this->tokens as $i => $token) {
266 if ($token && '-' === $token[0]) { 267 if ($token && '-' === $token[0]) {
268 if (false !== strpos($token, '=') || !isset($this->tokens[$i + 1])) {
269 continue;
270 }
271
272 // If it's a long option, consider that everything after "--" is the option name.
273 // Otherwise, use the last char (if it's a short option set, only the last one can take a value with space separator)
274 $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1);
275 if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) {
276 // noop
277 } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) {
278 $isOption = true;
279 }
280
281 continue;
282 }
283
284 if ($isOption) {
285 $isOption = false;
267 continue; 286 continue;
268 } 287 }
269 288
270 return $token; 289 return $token;
271 } 290 }