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|null
getArgumentAt(int $index)
Get positional arguments by index.
int
$index The argument index to access.
string|null
The 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|null
The option value or null.
getOptions()
Get an array of all the options
array
hasArgument(string $name)
Check if a positional argument exists by name
string
$name The argument name to check.
bool
hasArgumentAt(int $index)
Check if a positional argument exists
int
$index The argument index to check.
bool
hasOption(string $name)
Check if an option is defined and not null.
string
$name The name of the option to check.
bool
Positional 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