The existing options are preserved.
public addOptions ( array $options ) : static | ||
$options | array | The options indexed by their long or short names and their values. |
return | static | The current instance. |
public function testAddOptions() { $format = ArgsFormat::build()->addOption(new Option('option1', null, Option::NO_VALUE))->addOption(new Option('option2', null, Option::OPTIONAL_VALUE))->addOption(new Option('option3', null, Option::NO_VALUE))->getFormat(); $args = new Args($format); $args->setOption('option1'); $args->addOptions(array('option2' => 'value', 'option3' => true)); $this->assertSame(array('option1' => true, 'option2' => 'value', 'option3' => true), $args->getOptions()); }