An object to represent a single option used in the command line.
ConsoleOptionParser creates these when you use addOption()
bool
Is the option a boolean option. Boolean options do not consume a parameter.
string[]
An array of choices for the option.
string|bool|null
Default value for the option
string
Help text for the option.
bool
Can the option accept multiple value definition.
string
Name of the option
string
Short (1 character) alias for the option.
bool
Is the option required.
__construct(string $name, string $short, string $help, bool $isBoolean, mixed $default, array $choices, bool $multiple, bool $required)
Make a new Input Option
string
$name The long name of the option, or an array with all the properties.
string
$short optional The short alias for this option
string
$help optional The help text for this option
bool
$isBoolean optional Whether this option is a boolean option. Boolean options don't consume extra tokens
string|bool|null
$default optional The default value for this option.
string[]
$choices optional Valid choices for this option.
bool
$multiple optional Whether this option can accept multiple value definition.
bool
$required optional Whether this option is required or not.
Cake\Console\Exception\ConsoleException
acceptsMultiple()
Check if this option accepts multiple values.
bool
defaultValue()
Get the default value for this option
string|bool|null
help(int $width)
Generate the help for this this option.
int
$width optional The width to make the name of the option.
string
isBoolean()
Check if this option is a boolean option
bool
isRequired()
Check if this option is required
bool
name()
Get the value of the name attribute.
string
Value of this->_name.
short()
Get the value of the short attribute.
string
Value of this->_short.
usage()
Get the usage value for this option
string
validChoice(mixed $value)
Check that a value is a valid choice for this option.
string|bool
$value The choice to validate.
true
Cake\Console\Exception\ConsoleException
xml(\SimpleXMLElement $parent)
Append the option's XML into the parent.
\SimpleXMLElement
$parent The parent element.
\SimpleXMLElement
The parent with this option appended.
Is the option a boolean option. Boolean options do not consume a parameter.
bool
An array of choices for the option.
string[]
Default value for the option
string|bool|null
Help text for the option.
string
Can the option accept multiple value definition.
bool
Name of the option
string
Short (1 character) alias for the option.
string
Is the option required.
bool
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Console.ConsoleInputOption.html