An object to represent a single option used in the command line.
ConsoleOptionParser creates these when you use addOption()
boolIs the option a boolean option. Boolean options do not consume a parameter.
string[]An array of choices for the option.
string|bool|nullDefault value for the option
stringHelp text for the option.
boolCan the option accept multiple value definition.
stringName of the option
stringShort (1 character) alias for the option.
boolIs 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\ConsoleExceptionacceptsMultiple()
Check if this option accepts multiple values.
booldefaultValue()
Get the default value for this option
string|bool|nullhelp(int $width)
Generate the help for this this option.
int $width optional The width to make the name of the option.
stringisBoolean()
Check if this option is a boolean option
boolisRequired()
Check if this option is required
boolname()
Get the value of the name attribute.
stringValue of this->_name.
short()
Get the value of the short attribute.
stringValue of this->_short.
usage()
Get the usage value for this option
stringvalidChoice(mixed $value)
Check that a value is a valid choice for this option.
string|bool $value The choice to validate.
trueCake\Console\Exception\ConsoleExceptionxml(\SimpleXMLElement $parent)
Append the option's XML into the parent.
\SimpleXMLElement $parent The parent element.
\SimpleXMLElementThe parent with this option appended.
Is the option a boolean option. Boolean options do not consume a parameter.
boolAn array of choices for the option.
string[]Default value for the option
string|bool|nullHelp text for the option.
stringCan the option accept multiple value definition.
boolName of the option
stringShort (1 character) alias for the option.
stringIs 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