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