\OutputFormatterStyle

Formatter style class for defining styles.

Summary

Methods
Properties
Constants
__construct()
setForeground()
setBackground()
setOption()
unsetOption()
setOptions()
apply()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$availableForegroundColors
$availableBackgroundColors
$availableOptions
$foreground
$background
$options
N/A

Properties

$availableForegroundColors

$availableForegroundColors : 

Type

$availableBackgroundColors

$availableBackgroundColors : 

Type

$availableOptions

$availableOptions : 

Type

$foreground

$foreground : 

Type

$background

$background : 

Type

$options

$options : 

Type

Methods

__construct()

__construct(string|null  $foreground = null, string|null  $background = null, array  $options = array()) 

Initializes output formatter style.

Parameters

string|null $foreground

The style foreground color name

string|null $background

The style background color name

array $options

The style options

setForeground()

setForeground(string|null  $color = null) 

Sets style foreground color.

Parameters

string|null $color

The color name

Throws

\InvalidArgumentException

When the color name isn't defined

setBackground()

setBackground(string|null  $color = null) 

Sets style background color.

Parameters

string|null $color

The color name

Throws

\InvalidArgumentException

When the color name isn't defined

setOption()

setOption(string  $option) 

Sets some specific style option.

Parameters

string $option

The option name

Throws

\InvalidArgumentException

When the option name isn't defined

unsetOption()

unsetOption(string  $option) 

Unsets some specific style option.

Parameters

string $option

The option name

Throws

\InvalidArgumentException

When the option name isn't defined

setOptions()

setOptions(array  $options) 

Sets multiple style options at once.

Parameters

array $options

apply()

apply(string  $text) : string

Applies the style to a given text.

Parameters

string $text

The text to style

Returns

string