PHP Класс think\console\output\formatter\Style

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string | null $foreground = null, string | null $background = null, array $options = [] ) 初始化输出的样式
apply ( string $text ) : string 应用样式到文字
setBackground ( string | null $color = null ) 设置背景色
setForeground ( string | null $color = null ) 设置字体颜色
setOption ( string $option ) 设置字体格式
setOptions ( array $options ) 批量设置字体格式
unsetOption ( string $option ) 重置字体格式

Описание методов

__construct() публичный Метод

初始化输出的样式
public __construct ( string | null $foreground = null, string | null $background = null, array $options = [] )
$foreground string | null 字体颜色
$background string | null 背景色
$options array 格式

apply() публичный Метод

应用样式到文字
public apply ( string $text ) : string
$text string 文字
Результат string

setBackground() публичный Метод

设置背景色
public setBackground ( string | null $color = null )
$color string | null 颜色名

setForeground() публичный Метод

设置字体颜色
public setForeground ( string | null $color = null )
$color string | null 颜色名

setOption() публичный Метод

设置字体格式
public setOption ( string $option )
$option string 格式名

setOptions() публичный Метод

批量设置字体格式
public setOptions ( array $options )
$options array

unsetOption() публичный Метод

重置字体格式
public unsetOption ( string $option )
$option string 格式名