Class Symfony\Component\Console\Formatter\OutputFormatterStyle

InheritanceSymfony\Component\Console\Formatter\OutputFormatterStyle
ImplementsSymfony\Component\Console\Formatter\OutputFormatterStyleInterface

Formatter style class for defining styles.

Method Details

__construct() public method

Initializes output formatter style.

public void __construct ( $foreground null, $background null, array $options = [] )
$foreground string|null

The style foreground color name

$background string|null

The style background color name

$options array

The style options

apply() public method

Applies the style to a given text.

public string apply ( $text )
$text string

The text to style

setBackground() public method

Sets style background color.

public void setBackground ( $color null )
$color string|null

The color name

throws Symfony\Component\Console\Exception\InvalidArgumentException

When the color name isn't defined

setForeground() public method

Sets style foreground color.

public void setForeground ( $color null )
$color string|null

The color name

throws Symfony\Component\Console\Exception\InvalidArgumentException

When the color name isn't defined

setOption() public method

Sets some specific style option.

public void setOption ( $option )
$option string

The option name

throws Symfony\Component\Console\Exception\InvalidArgumentException

When the option name isn't defined

setOptions() public method

Sets multiple style options at once.

public void setOptions ( array $options )
$options array
unsetOption() public method

Unsets some specific style option.

public void unsetOption ( $option )
$option string

The option name

throws Symfony\Component\Console\Exception\InvalidArgumentException

When the option name isn't defined