Provides an interface for interacting with a command's options and arguments.
__construct(array $args, array $options, array $argNames)
Constructor
string[] $args Positional arguments
array $options Named arguments
string[] $argNames List of argument names. Order is expected to be the same as $args.
getArgument(string $name)
Check if a positional argument exists by name
string $name The argument name to check.
string|nullgetArgumentAt(int $index)
Get positional arguments by index.
int $index The argument index to access.
string|nullThe argument value or null
getArguments()
Get all positional arguments.
string[]getOption(string $name)
Get an option's value or null
string $name The name of the option to check.
string|int|bool|nullThe option value or null.
getOptions()
Get an array of all the options
arrayhasArgument(string $name)
Check if a positional argument exists by name
string $name The argument name to check.
boolhasArgumentAt(int $index)
Check if a positional argument exists
int $index The argument index to check.
boolhasOption(string $name)
Check if an option is defined and not null.
string $name The name of the option to check.
boolPositional argument name map
string[]Positional arguments.
string[]Named options
array
© 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.Arguments.html