Exemple #1
0
 /**
  * Extends the list of known options. Takes the same argument types as the constructor.
  *
  * @param mixed $options
  * @throws \InvalidArgumentException
  */
 public function addOptions($options)
 {
     if (is_string($options)) {
         $this->mergeOptions($this->optionParser->parseString($options));
     } elseif (is_array($options)) {
         $this->mergeOptions($this->optionParser->parseArray($options));
     } else {
         throw new \InvalidArgumentException("Getopt(): argument must be string or array");
     }
 }
 public function testParseArrayInvalid()
 {
     $this->setExpectedException('InvalidArgumentException');
     $this->parser->parseArray(array('a', 'b'));
 }