OutputFormatterStyle

class OutputFormatterStyle implements OutputFormatterStyleInterface

Formatter style class for defining styles.

Methods

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

Initializes output formatter style.

setForeground(string $color = null)

Sets style foreground color.

setBackground(string $color = null)

Sets style background color.

setOption(string $option)

Sets some specific style option.

unsetOption(string $option)

Unsets some specific style option.

setOptions(array $options)

Sets multiple style options at once.

string apply(string $text)

Applies the style to a given text.

Details

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

Initializes output formatter style.

Parameters

string $foreground The style foreground color name
string $background The style background color name
array $options The style options

setForeground(string $color = null)

Sets style foreground color.

Parameters

string $color The color name

Exceptions

InvalidArgumentException When the color name isn't defined

setBackground(string $color = null)

Sets style background color.

Parameters

string $color The color name

Exceptions

InvalidArgumentException When the color name isn't defined

setOption(string $option)

Sets some specific style option.

Parameters

string $option The option name

Exceptions

InvalidArgumentException When the option name isn't defined

unsetOption(string $option)

Unsets some specific style option.

Parameters

string $option The option name

Exceptions

InvalidArgumentException When the option name isn't defined

setOptions(array $options)

Sets multiple style options at once.

Parameters

array $options

string apply(string $text)

Applies the style to a given text.

Parameters

string $text The text to style

Return Value

string

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Console/Formatter/OutputFormatterStyle.html