Class Symfony\Component\Console\Formatter\OutputFormatter


Formatter class for console output.

Method Details

__construct() public method

Initializes console output formatter.

public void __construct ( $decorated false, array $styles = [] )
$decorated bool

Whether this formatter should actually decorate strings

$styles Symfony\Component\Console\Formatter\OutputFormatterStyleInterface[]

Array of "name => FormatterStyle" instances

escape() public static method

Escapes "<" special char in given text.

public static string escape ( $text )
$text string

Text to escape

return string

Escaped text

format() public method

Formats a message according to the given styles.

public string format ( $message )
$message string

The message to style

return string

The styled message

getStyle() public method

Gets style options from style with specified name.

public Symfony\Component\Console\Formatter\OutputFormatterStyleInterface getStyle ( $name )
$name string
throws Symfony\Component\Console\Exception\InvalidArgumentException

When style isn't defined

getStyleStack() public method

public Symfony\Component\Console\Formatter\OutputFormatterStyleStack getStyleStack ( )
hasStyle() public method

Checks if output formatter has style with specified name.

public bool hasStyle ( $name )
$name string
isDecorated() public method

Gets the decorated flag.

public bool isDecorated ( )
return bool

True if the output will decorate messages, false otherwise

setDecorated() public method

Sets the decorated flag.

public void setDecorated ( $decorated )
$decorated bool

Whether to decorate the messages or not

setStyle() public method

Sets a new style.

public void setStyle ( $name, Symfony\Component\Console\Formatter\OutputFormatterStyleInterface $style )
$name string

The style name

$style Symfony\Component\Console\Formatter\OutputFormatterStyleInterface

The style instance