12 namespace Symfony\Component\Console\Input;
57 $this->arguments = array();
58 $this->options = array();
67 abstract protected function parse();
76 if (count($this->arguments) < $this->definition->getArgumentRequiredCount()) {
77 throw new \RuntimeException(
'Not enough arguments.');
108 return array_merge($this->definition->getArgumentDefaults(),
$this->arguments);
122 if (!$this->definition->hasArgument($name)) {
123 throw new \InvalidArgumentException(sprintf(
'The "%s" argument does not exist.', $name));
126 return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
139 if (!$this->definition->hasArgument($name)) {
140 throw new \InvalidArgumentException(sprintf(
'The "%s" argument does not exist.', $name));
143 $this->arguments[$name] = $value;
155 return $this->definition->hasArgument($name);
165 return array_merge($this->definition->getOptionDefaults(),
$this->options);
179 if (!$this->definition->hasOption($name)) {
180 throw new \InvalidArgumentException(sprintf(
'The "%s" option does not exist.', $name));
183 return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
196 if (!$this->definition->hasOption($name)) {
197 throw new \InvalidArgumentException(sprintf(
'The "%s" option does not exist.', $name));
200 $this->options[$name] = $value;
212 return $this->definition->hasOption($name);
224 return preg_match(
'{^[\w-]+$}', $token) ? $token : escapeshellarg($token);