OutputFormatterStyle
in package
implements
OutputFormatterStyleInterface
Formatter style class for defining styles.
Tags
Table of Contents
Interfaces
- OutputFormatterStyleInterface
- Formatter style interface for defining styles.
Properties
- $availableBackgroundColors : mixed
- $availableForegroundColors : mixed
- $availableOptions : mixed
- $background : mixed
- $foreground : mixed
- $options : mixed
Methods
- __construct() : mixed
- Initializes output formatter style.
- apply() : string
- Applies the style to a given text.
- setBackground() : mixed
- Sets style background color.
- setForeground() : mixed
- Sets style foreground color.
- setOption() : mixed
- Sets some specific style option.
- setOptions() : mixed
- Sets multiple style options at once.
- unsetOption() : mixed
- Unsets some specific style option.
Properties
$availableBackgroundColors
private
static mixed
$availableBackgroundColors
= array('black' => array('set' => 40, 'unset' => 49), 'red' => array('set' => 41, 'unset' => 49), 'green' => array('set' => 42, 'unset' => 49), 'yellow' => array('set' => 43, 'unset' => 49), 'blue' => array('set' => 44, 'unset' => 49), 'magenta' => array('set' => 45, 'unset' => 49), 'cyan' => array('set' => 46, 'unset' => 49), 'white' => array('set' => 47, 'unset' => 49), 'default' => array('set' => 49, 'unset' => 49))
$availableForegroundColors
private
static mixed
$availableForegroundColors
= array('black' => array('set' => 30, 'unset' => 39), 'red' => array('set' => 31, 'unset' => 39), 'green' => array('set' => 32, 'unset' => 39), 'yellow' => array('set' => 33, 'unset' => 39), 'blue' => array('set' => 34, 'unset' => 39), 'magenta' => array('set' => 35, 'unset' => 39), 'cyan' => array('set' => 36, 'unset' => 39), 'white' => array('set' => 37, 'unset' => 39), 'default' => array('set' => 39, 'unset' => 39))
$availableOptions
private
static mixed
$availableOptions
= array('bold' => array('set' => 1, 'unset' => 22), 'underscore' => array('set' => 4, 'unset' => 24), 'blink' => array('set' => 5, 'unset' => 25), 'reverse' => array('set' => 7, 'unset' => 27), 'conceal' => array('set' => 8, 'unset' => 28))
$background
private
mixed
$background
$foreground
private
mixed
$foreground
$options
private
mixed
$options
= array()
Methods
__construct()
Initializes output formatter style.
public
__construct([string|null $foreground = null ][, string|null $background = null ][, array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $foreground : string|null = null
-
The style foreground color name
- $background : string|null = null
-
The style background color name
- $options : array<string|int, mixed> = array()
-
The style options
apply()
Applies the style to a given text.
public
apply(string $text) : string
Parameters
- $text : string
-
The text to style
Return values
stringsetBackground()
Sets style background color.
public
setBackground([string|null $color = null ]) : mixed
Parameters
- $color : string|null = null
-
The color name
Tags
setForeground()
Sets style foreground color.
public
setForeground([string|null $color = null ]) : mixed
Parameters
- $color : string|null = null
-
The color name
Tags
setOption()
Sets some specific style option.
public
setOption(string $option) : mixed
Parameters
- $option : string
-
The option name
Tags
setOptions()
Sets multiple style options at once.
public
setOptions(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
unsetOption()
Unsets some specific style option.
public
unsetOption(string $option) : mixed
Parameters
- $option : string
-
The option name