HasParams
A trait for application classes to use which provides some useful wrapper methods using the Params class.
Table of Contents
- dispatch_params() : mixed
- A method to parse the command line parameters, get the command, and dispatch to a method named handle_{groupname} where {groupname} is the 'name' property of the ParamGroup object that matched the command spec.
Methods
dispatch_params()
A method to parse the command line parameters, get the command, and dispatch to a method named handle_{groupname} where {groupname} is the 'name' property of the ParamGroup object that matched the command spec.
protected
dispatch_params(Params $params) : mixed
If the method doesn't exist, an exception will be thrown.
If no command groups were defined, or none of the defined commands matched, it looks for a handle_default() method instead.
Alternatively, if no command groups were defined, a method called handle_params() may be used instead of handle_default(). Likewise if commands were defined, but no command matched, a method called handle_no_command() may be used instead of handle_default().
The parsed parameters array will be passed to the matching method as the first argument, the Params instance will be passed as the second argument. No other arguments are passed.
If no valid methods at all were found, this will throw an Exception.
Parameters
- $params : Params
-
The Params instance we are using.
Return values
mixed —The output from the matched method.