Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/console/Input/ArrayInput.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/symfony/console/Input/ArrayInput.php Mon Apr 23 09:33:26 2018 +0100 +++ b/vendor/symfony/console/Input/ArrayInput.php Mon Apr 23 09:46:53 2018 +0100 @@ -27,12 +27,6 @@ { private $parameters; - /** - * Constructor. - * - * @param array $parameters An array of parameters - * @param InputDefinition|null $definition A InputDefinition instance - */ public function __construct(array $parameters, InputDefinition $definition = null) { $this->parameters = $parameters; @@ -66,7 +60,7 @@ $v = $k; } - if ($onlyParams && $v === '--') { + if ($onlyParams && '--' === $v) { return false; } @@ -86,7 +80,7 @@ $values = (array) $values; foreach ($this->parameters as $k => $v) { - if ($onlyParams && ($k === '--' || (is_int($k) && $v === '--'))) { + if ($onlyParams && ('--' === $k || (is_int($k) && '--' === $v))) { return false; } @@ -112,9 +106,15 @@ $params = array(); foreach ($this->parameters as $param => $val) { if ($param && '-' === $param[0]) { - $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); + if (is_array($val)) { + foreach ($val as $v) { + $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : ''); + } + } else { + $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); + } } else { - $params[] = $this->escapeToken($val); + $params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val); } } @@ -127,7 +127,7 @@ protected function parse() { foreach ($this->parameters as $key => $value) { - if ($key === '--') { + if ('--' === $key) { return; } if (0 === strpos($key, '--')) { @@ -179,7 +179,9 @@ throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name)); } - $value = $option->isValueOptional() ? $option->getDefault() : true; + if (!$option->isValueOptional()) { + $value = true; + } } $this->options[$name] = $value;