Shell dispatcher handles dispatching cli commands.
Consult /bin/cake.php for how this class is used in practice.
__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.
boolean
_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 [] requested
: if used, will prevent the Shell welcome message to be displayedboolean
Cake\Console\Exception\MissingShellMethodException
_handleAlias( string $shell )
If the input matches an alias, return the aliased shell name
$shell
string
_initEnvironment( )
Defines current working environment.
Cake\Core\Exception\Exception
_shellExists( string $shell )
Check if a shell class exists for the given name.
$shell
string|boolean
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
array
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 string|false
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 [] requested
: if used, will prevent the Shell welcome message to be displayedinteger
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 [] integer
shiftArgs( )
Removes first argument and shifts other arguments up
mixed
© 2005–2016 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.
http://api.cakephp.org/3.1/class-Cake.Console.ShellDispatcher.html