Class Arguments
Provides an interface for interacting with a command's options and arguments.
Properties summary
Method Summary
Method Detail
__construct() public
__construct(array $args, array $options, array $argNames)
Constructor
Parameters
-
string[]
$args Positional arguments
-
array
$options Named arguments
-
string[]
$argNames List of argument names. Order is expected to be the same as $args.
getArgument() public
getArgument(string $name)
Check if a positional argument exists by name
Parameters
-
string
$name The argument name to check.
Returns
string|null
getArgumentAt() public
getArgumentAt(int $index)
Get positional arguments by index.
Parameters
-
int
$index The argument index to access.
Returns
string|null
The argument value or null
getArguments() public
getArguments()
Get all positional arguments.
Returns
string[]
getOption() public
getOption(string $name)
Get an option's value or null
Parameters
-
string
$name The name of the option to check.
Returns
string|int|bool|null
The option value or null.
getOptions() public
getOptions()
Get an array of all the options
Returns
array
hasArgument() public
hasArgument(string $name)
Check if a positional argument exists by name
Parameters
-
string
$name The argument name to check.
Returns
bool
hasArgumentAt() public
hasArgumentAt(int $index)
Check if a positional argument exists
Parameters
-
int
$index The argument index to check.
Returns
bool
hasOption() public
hasOption(string $name)
Check if an option is defined and not null.
Parameters
-
string
$name The name of the option to check.
Returns
bool
Property Detail
$argNames protected
Positional argument name map
Type
string[]
$args protected
Positional arguments.
Type
string[]
$options protected
Named options
Type
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.0/class-Cake.Console.Arguments.html