Shell dispatcher handles dispatching cli commands.
Consult /bin/cake.php for how this class is used in practice.
array
$args
public array
__construct( array $args [] , boolean $bootstrap true )
Constructor
The execution of the script is stopped after dispatching the request with a status code of either 0 or 1 according to the result of the dispatch.
$args
optional [] $bootstrap
optional true _bootstrap( )
Initializes the environment and loads the CakePHP core.
_createShell( string $className , string $shortName )
Create the given shell name, and set the plugin property
$className
$shortName
Cake\Console\Shell
_dispatch( array $extra [] )
Dispatch a request.
$extra
optional [] Extra parameters that you can manually pass to the Shell to be dispatched. Built-in extra parameter is : - requested
: if used, will prevent the Shell welcome message to be displayed
Cake\Console\Exception\MissingShellMethodException
_handleAlias( string $shell )
If the input matches an alias, return the aliased shell name
$shell
_initEnvironment( )
Defines current working environment.
Cake\Core\Exception\Exception
_shellExists( string $shell )
Check if a shell class exists for the given name.
$shell
addShortPluginAliases( )
For all loaded plugins, add a short alias
This permits a plugin which implements a shell of the same name to be accessed Using the shell name alone
alias( string $short , string|null $original null )
Add an alias for a shell command.
Aliases allow you to call shells by alternate names. This is most useful when dealing with plugin shells that you want to have shorter names for.
If you re-use an alias the last alias set will be the one available.
Aliasing a shell named ClassName:
$this->alias('alias', 'ClassName');
Getting the original name for a given alias:
$this->alias('alias');
$short
$original
optional null dispatch( array $extra [] )
Dispatches a CLI request
Converts a shell command result into an exit code. Null/True are treated as success. All other return values are an error.
$extra
optional [] Extra parameters that you can manually pass to the Shell to be dispatched. Built-in extra parameter is : - requested
: if used, will prevent the Shell welcome message to be displayed
findShell( string $shell )
Get shell to use, either plugin shell or application shell
All paths in the loaded shell paths are searched, handles alias dereferencing
$shell
Cake\Console\Shell
Cake\Console\Exception\MissingShellException
help( )
Shows console help. Performs an internal dispatch to the CommandList Shell
run( array $argv , array $extra [] )
Run the dispatcher
$argv
$extra
optional [] shiftArgs( )
Removes first argument and shifts other arguments up
version( )
Prints the currently installed version of CakePHP. Performs an internal dispatch to the CommandList Shell
© 2005–2017 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/3.4/class-Cake.Console.ShellDispatcher.html