PHP Class Cml\Console\Console

Inheritance: implements Cml\Interfaces\Console
ファイルを表示 Open project: linhecheng/cmlphp

Protected Properties

Property Type Description
$commands array 存放所有命令

Public Methods

Method Description
__construct ( array $commands = [] ) Console constructor.
addCommand ( string $class, null $alias = null ) 注册一个命令
addCommands ( array $commands ) 批量添加命令
camelCaseToDash ( string $string ) : string 将小驼峰转换为xx-xx返回
dashToCamelCase ( string $string ) : string 将xx-xx转换为小驼峰返回
getCommand ( string $name ) : mixed 获取某个命令
getCommands ( ) : array 获取所有命令列表
hasCommand ( string $name ) : boolean 判断是否有无命令
run ( array $argv = null ) : mixed 运行命令

Method Details

__construct() public method

Console constructor.
public __construct ( array $commands = [] )
$commands array

addCommand() public method

注册一个命令
public addCommand ( string $class, null $alias = null )
$class string 类名
$alias null 命令别名

addCommands() public method

批量添加命令
public addCommands ( array $commands )
$commands array 命令列表

camelCaseToDash() public static method

将小驼峰转换为xx-xx返回
public static camelCaseToDash ( string $string ) : string
$string string
return string

dashToCamelCase() public static method

将xx-xx转换为小驼峰返回
public static dashToCamelCase ( string $string ) : string
$string string
return string

getCommand() public method

获取某个命令
public getCommand ( string $name ) : mixed
$name string 命令的别名
return mixed

getCommands() public method

获取所有命令列表
public getCommands ( ) : array
return array

hasCommand() public method

判断是否有无命令
public hasCommand ( string $name ) : boolean
$name string 命令的别名
return boolean

run() public method

运行命令
public run ( array $argv = null ) : mixed
$argv array
return mixed

Property Details

$commands protected_oe property

存放所有命令
protected array $commands
return array