Webmozart\Console\Api\Args\Format\ArgsFormatBuilder::setOptions PHP Method

setOptions() public method

Any existing options are removed when this method is called.
See also: addOption()
public setOptions ( array $options ) : static
$options array The options of the built format.
return static The current instance.
    public function setOptions(array $options)
    {
        $this->options = array();
        $this->optionsByShortName = array();
        $this->addOptions($options);
        return $this;
    }

Usage Example

 public function testSetOptions()
 {
     $this->builder->addOption($option1 = new Option('option1'));
     $this->builder->setOptions(array($option2 = new Option('option2'), $option3 = new Option('option3')));
     $this->assertSame(array('option2' => $option2, 'option3' => $option3), $this->builder->getOptions());
 }