PHP Class think\console\output\Formatter

Mostra file Open project: top-think/framework Class Usage Examples

Public Methods

Method Description
__construct ( ) 初始化命令行输出格式
escape ( string $text ) : string 转义
format ( string $message ) : string 使用所给的样式格式化文字
getStyle ( string $name ) : Style 获取样式
getStyleStack ( ) : Stack
hasStyle ( string $name ) : boolean 是否有这个样式
isDecorated ( ) : boolean 获取外观标识
setDecorated ( boolean $decorated ) 设置外观标识
setStyle ( string $name, Style $style ) 添加一个新样式

Private Methods

Method Description
applyCurrentStyle ( string $text ) : string 从堆栈应用样式到文字
createStyleFromString ( string $string ) : Style | boolean 根据字符串创建新的样式实例

Method Details

__construct() public method

初始化命令行输出格式
public __construct ( )

escape() public static method

转义
public static escape ( string $text ) : string
$text string
return string

format() public method

使用所给的样式格式化文字
public format ( string $message ) : string
$message string 文字
return string

getStyle() public method

获取样式
public getStyle ( string $name ) : Style
$name string
return think\console\output\formatter\Style

getStyleStack() public method

public getStyleStack ( ) : Stack
return think\console\output\formatter\Stack

hasStyle() public method

是否有这个样式
public hasStyle ( string $name ) : boolean
$name string
return boolean

isDecorated() public method

获取外观标识
public isDecorated ( ) : boolean
return boolean

setDecorated() public method

设置外观标识
public setDecorated ( boolean $decorated )
$decorated boolean 是否美化文字

setStyle() public method

添加一个新样式
public setStyle ( string $name, Style $style )
$name string 样式名
$style think\console\output\formatter\Style 样式实例