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

setCommandOptions() public method

Any existing command options are removed when this method is called.
See also: addCommandOption()
public setCommandOptions ( array $commandOptions ) : static
$commandOptions array The command options of the built format.
return static The current instance.
    public function setCommandOptions(array $commandOptions)
    {
        $this->commandOptions = array();
        $this->commandOptionsByShortName = array();
        $this->addCommandOptions($commandOptions);
        return $this;
    }

Usage Example

 public function testSetCommandOptions()
 {
     $this->builder->addCommandOption($option1 = new CommandOption('option1'));
     $this->builder->setCommandOptions(array($option2 = new CommandOption('option2'), $option3 = new CommandOption('option3')));
     $this->assertSame(array($option2, $option3), $this->builder->getCommandOptions());
 }