/** * Sets the value of an argument. * * The value is converted to the type defined by the argument format. * * @param string|int $name The argument name or its 0-based position in the * argument list. * @param mixed $value The value of the argument. * * @return static The current instance. * * @throws NoSuchArgumentException If the argument does not exist. */ public function setArgument($name, $value) { $argument = $this->format->getArgument($name); if ($argument->isMultiValued()) { $value = (array) $value; foreach ($value as $k => $v) { $value[$k] = $argument->parseValue($v); } } else { $value = $argument->parseValue($value); } $this->arguments[$argument->getName()] = $value; return $this; }
/** * @expectedException \InvalidArgumentException */ public function testGetArgumentFailsIfIncludeBaseNoBoolean() { $format = new ArgsFormat(); $format->getArgument('argument', 1234); }