addOption() public method

Read {@link Option} for a more detailed description of console options.
See also: getOptions()
public addOption ( string $longName, string $shortName = null, integer $flags, string $description = null, mixed $default = null, string $valueName = '...' ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
$longName string The long option name.
$shortName string The short option name. Can be `null`.
$flags integer A bitwise combination of the flag constants in the {@link Option} class.
$description string A one-line description of the option.
$default mixed The default value. Must be `null` if the flags contain {@link Option::REQUIRED_VALUE}.
$valueName string The name of the value to be used in usage examples of the option.
return ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.
Example #1
0
 public function testAddOption()
 {
     $this->config->addOption('option1', 'o', Option::REQUIRED_VALUE, 'Description 1');
     $this->config->addOption('option2', 'p', Option::OPTIONAL_VALUE, 'Description 2', 'Default');
     $this->assertEquals(array('option1' => new Option('option1', 'o', Option::REQUIRED_VALUE, 'Description 1'), 'option2' => new Option('option2', 'p', Option::OPTIONAL_VALUE, 'Description 2', 'Default')), $this->config->getOptions());
 }