PHP 클래스 Cake\Console\ShellDispatcher

Consult /bin/cake.php for how this class is used in practice.
파일 보기 프로젝트 열기: cakephp/cakephp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$args array Contains arguments parsed from the command line.

보호된 프로퍼티들

프로퍼티 타입 설명
$_aliases array List of connected aliases.

공개 메소드들

메소드 설명
__construct ( array $args = [], boolean $bootstrap = true ) Constructor
addShortPluginAliases ( ) : array For all loaded plugins, add a short alias
alias ( string $short, string | null $original = null ) : string | false Add an alias for a shell command.
dispatch ( array $extra = [] ) : integer Dispatches a CLI request
findShell ( string $shell ) : Shell Get shell to use, either plugin shell or application shell
help ( ) : void Shows console help. Performs an internal dispatch to the CommandList Shell
resetAliases ( ) : void Clear any aliases that have been set.
run ( array $argv, array $extra = [] ) : integer Run the dispatcher
shiftArgs ( ) : mixed Removes first argument and shifts other arguments up
version ( ) : void Prints the currently installed version of CakePHP. Performs an internal dispatch to the CommandList Shell

보호된 메소드들

메소드 설명
_bootstrap ( ) : boolean Initializes the environment and loads the CakePHP core.
_createShell ( string $className, string $shortName ) : Shell Create the given shell name, and set the plugin property
_dispatch ( array $extra = [] ) : boolean Dispatch a request.
_handleAlias ( string $shell ) : string If the input matches an alias, return the aliased shell name
_initEnvironment ( ) : void Defines current working environment.
_shellExists ( string $shell ) : string | boolean Check if a shell class exists for the given name.

메소드 상세

__construct() 공개 메소드

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.
public __construct ( array $args = [], boolean $bootstrap = true )
$args array the argv from PHP
$bootstrap boolean Should the environment be bootstrapped.

_bootstrap() 보호된 메소드

Initializes the environment and loads the CakePHP core.
protected _bootstrap ( ) : boolean
리턴 boolean Success.

_createShell() 보호된 메소드

Create the given shell name, and set the plugin property
protected _createShell ( string $className, string $shortName ) : Shell
$className string The class name to instantiate
$shortName string The plugin-prefixed shell name
리턴 Shell A shell instance.

_dispatch() 보호된 메소드

Dispatch a request.
protected _dispatch ( array $extra = [] ) : boolean
$extra array 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
리턴 boolean

_handleAlias() 보호된 메소드

If the input matches an alias, return the aliased shell name
protected _handleAlias ( string $shell ) : string
$shell string Optionally the name of a plugin or alias
리턴 string Shell name with plugin prefix

_initEnvironment() 보호된 메소드

Defines current working environment.
protected _initEnvironment ( ) : void
리턴 void

_shellExists() 보호된 메소드

Check if a shell class exists for the given name.
protected _shellExists ( string $shell ) : string | boolean
$shell string The shell name to look for.
리턴 string | boolean Either the classname or false.

addShortPluginAliases() 공개 메소드

This permits a plugin which implements a shell of the same name to be accessed Using the shell name alone
public addShortPluginAliases ( ) : array
리턴 array the resultant list of aliases

alias() 공개 정적인 메소드

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. ### Usage Aliasing a shell named ClassName: $this->alias('alias', 'ClassName'); Getting the original name for a given alias: $this->alias('alias');
public static alias ( string $short, string | null $original = null ) : string | false
$short string The new short name for the shell.
$original string | null The original full name for the shell.
리턴 string | false The aliased class name, or false if the alias does not exist

dispatch() 공개 메소드

Converts a shell command result into an exit code. Null/True are treated as success. All other return values are an error.
public dispatch ( array $extra = [] ) : integer
$extra array 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
리턴 integer The cli command exit code. 0 is success.

findShell() 공개 메소드

All paths in the loaded shell paths are searched, handles alias dereferencing
public findShell ( string $shell ) : Shell
$shell string Optionally the name of a plugin
리턴 Shell A shell instance.

help() 공개 메소드

Shows console help. Performs an internal dispatch to the CommandList Shell
public help ( ) : void
리턴 void

resetAliases() 공개 정적인 메소드

Clear any aliases that have been set.
public static resetAliases ( ) : void
리턴 void

run() 공개 정적인 메소드

Run the dispatcher
public static run ( array $argv, array $extra = [] ) : integer
$argv array The argv from PHP
$extra array Extra parameters
리턴 integer The exit code of the shell process.

shiftArgs() 공개 메소드

Removes first argument and shifts other arguments up
public shiftArgs ( ) : mixed
리턴 mixed Null if there are no arguments otherwise the shifted argument

version() 공개 메소드

Prints the currently installed version of CakePHP. Performs an internal dispatch to the CommandList Shell
public version ( ) : void
리턴 void

프로퍼티 상세

$_aliases 보호되어 있는 정적으로 프로퍼티

List of connected aliases.
protected static array $_aliases
리턴 array

$args 공개적으로 프로퍼티

Contains arguments parsed from the command line.
public array $args
리턴 array