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.
array<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.
string|nullThe prompt string
boolIs the option required.
Make a new Input Option
Check if this option accepts multiple values.
Get the list of choices this option has.
Get the default value for this option
Generate the help for this this option.
Check if this option is a boolean option
Check if this option is required
Get the value of the name attribute.
Get the prompt string
Get the value of the short attribute.
Get the usage value for this option
Check that a value is a valid choice for this option.
Append the option's XML into the parent.
__construct(string $name, string $short = '', string $help = '', bool $isBoolean = false, string|bool|null $default = null, array<string> $choices = [], bool $multiple = false, bool $required = false, string|null $prompt = null)
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.
array<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.
string|null $prompt optional The prompt string.
Cake\Console\Exception\ConsoleExceptionacceptsMultiple(): bool
Check if this option accepts multiple values.
boolchoices(): array
Get the list of choices this option has.
arraydefaultValue(): string|bool|null
Get the default value for this option
string|bool|nullhelp(int $width = 0): string
Generate the help for this this option.
int $width optional The width to make the name of the option.
stringisBoolean(): bool
Check if this option is a boolean option
boolisRequired(): bool
Check if this option is required
boolname(): string
Get the value of the name attribute.
stringprompt(): string
Get the prompt string
stringshort(): string
Get the value of the short attribute.
stringusage(): string
Get the usage value for this option
stringvalidChoice(string|bool $value): true
Check that a value is a valid choice for this option.
string|bool $value The choice to validate.
trueCake\Console\Exception\ConsoleExceptionxml(SimpleXMLElement $parent): SimpleXMLElement
Append the option's XML into the parent.
SimpleXMLElement $parent The parent element.
SimpleXMLElementIs the option a boolean option. Boolean options do not consume a parameter.
boolAn array of choices for the option.
array<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.
stringThe prompt string
string|nullIs 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.4/class-Cake.Console.ConsoleInputOption.html