class InputOption
Represents a command line option.
VALUE_NONE | |
VALUE_REQUIRED | |
VALUE_OPTIONAL | |
VALUE_IS_ARRAY |
__construct(string $name, string|array $shortcut = null, int $mode = null, string $description = '', string|string[]|int|bool|null $default = null) | ||
string | getShortcut() Returns the option shortcut. | |
string | getName() Returns the option name. | |
bool | acceptValue() Returns true if the option accepts a value. | |
bool | isValueRequired() Returns true if the option requires a value. | |
bool | isValueOptional() Returns true if the option takes an optional value. | |
bool | isArray() Returns true if the option can take multiple values. | |
setDefault(string|string[]|int|bool|null $default = null) Sets the default value. | ||
string|string[]|int|bool|null | getDefault() Returns the default value. | |
string | getDescription() Returns the description text. | |
bool | equals(InputOption $option) Checks whether the given option equals this one. |
string | $name | The option name |
string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
int | $mode | The option mode: One of the VALUE_* constants |
string | $description | A description text |
string|string[]|int|bool|null | $default | The default value (must be null for self::VALUE_NONE) |
InvalidArgumentException | If option mode is invalid or incompatible |
Returns the option shortcut.
string | The shortcut |
Returns the option name.
string | The name |
Returns true if the option accepts a value.
bool | true if value mode is not self::VALUE_NONE, false otherwise |
Returns true if the option requires a value.
bool | true if value mode is self::VALUE_REQUIRED, false otherwise |
Returns true if the option takes an optional value.
bool | true if value mode is self::VALUE_OPTIONAL, false otherwise |
Returns true if the option can take multiple values.
bool | true if mode is self::VALUE_IS_ARRAY, false otherwise |
Sets the default value.
string|string[]|int|bool|null | $default | The default value |
LogicException | When incorrect default value is given |
Returns the default value.
string|string[]|int|bool|null | The default value |
Returns the description text.
string | The description text |
Checks whether the given option equals this one.
InputOption | $option |
bool |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Console/Input/InputOption.html