12 namespace Symfony\Component\Console\Input;
51 foreach ($this->parameters as $key => $value) {
52 if ($key &&
'-' === $key[0]) {
72 $values = (array) $values;
74 foreach ($this->parameters as $k => $v) {
79 if (in_array($v, $values)) {
100 $values = (array) $values;
102 foreach ($this->parameters as $k => $v) {
104 if (in_array($v, $values)) {
107 }
elseif (in_array($k, $values)) {
123 foreach ($this->parameters as $param => $val) {
124 if ($param &&
'-' === $param[0]) {
125 $params[] = $param.(
'' != $val ?
'='.$this->escapeToken($val) :
'');
131 return implode(
' ', $params);
139 foreach ($this->parameters as $key => $value) {
140 if (0 === strpos($key,
'--')) {
142 }
elseif (
'-' === $key[0]) {
160 if (!$this->definition->hasShortcut($shortcut)) {
161 throw new \InvalidArgumentException(sprintf(
'The "-%s" option does not exist.', $shortcut));
164 $this->
addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
178 if (!$this->definition->hasOption($name)) {
179 throw new \InvalidArgumentException(sprintf(
'The "--%s" option does not exist.', $name));
182 $option = $this->definition->getOption($name);
184 if (null === $value) {
185 if ($option->isValueRequired()) {
186 throw new \InvalidArgumentException(sprintf(
'The "--%s" option requires a value.', $name));
189 $value = $option->isValueOptional() ? $option->getDefault() :
true;
192 $this->options[$name] = $value;
205 if (!$this->definition->hasArgument($name)) {
206 throw new \InvalidArgumentException(sprintf(
'The "%s" argument does not exist.', $name));
209 $this->arguments[$name] = $value;