Class ShellDispatcher
Shell dispatcher handles dispatching cli commands.
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/Console/ShellDispatcher.php
Method Detail
__constructsource public
__construct( array $args array() , 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.
Parameters
- array
$args
optional array() - the argv from PHP
- boolean
$bootstrap
optional true - Should the environment be bootstrapped.
_bootstrapsource protected
_bootstrap( )
Initializes the environment and loads the CakePHP core.
Returns
boolean
Success.
_getShellsource protected
_getShell( string $shell )
Get shell to use, either plugin shell or application shell
All paths in the loaded shell paths are searched.
Parameters
- string
$shell
- Optionally the name of a plugin
Returns
mixed
An object
Throws
MissingShellException
when errors are encountered.
_initEnvironmentsource protected
_initEnvironment( )
Defines current working environment.
Throws
CakeException
CakeException
_parsePathssource protected
_parsePaths( array $args )
Parses out the paths from from the argv
Parameters
- array
$args
- The argv to parse.
_stopsource protected
_stop( integer|string $status 0 )
Stop execution of the current script
Parameters
- integer|string
$status
optional 0 - see http://php.net/exit for values
dispatchsource public
dispatch( )
Dispatches a CLI request
Returns
boolean
bool
Throws
MissingShellMethodException
MissingShellMethodException
helpsource public
help( )
Shows console help. Performs an internal dispatch to the CommandList Shell
parseParamssource public
parseParams( array $args )
Parses command line options and extracts the directory paths from $params
Parameters
- array
$args
- Parameters to parse
runsource public static
run( array $argv )
Run the dispatcher
Parameters
- array
$argv
- The argv from PHP
setErrorHandlerssource public
setErrorHandlers( )
Set the error/exception handlers for the console based on the Error.consoleHandler
, and Exception.consoleHandler
values if they are set. If they are not set, the default ConsoleErrorHandler will be used.
shiftArgssource public
shiftArgs( )
Removes first argument and shifts other arguments up
Returns
mixed
Null if there are no arguments otherwise the shifted argument
Properties summary
© 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/2.7/class-ShellDispatcher.html