Symfony2 API
Class

Symfony\Component\Console\Formatter\OutputFormatter

class OutputFormatter implements OutputFormatterInterface

Formatter class for console output.

Constants

FORMAT_PATTERN

The pattern to phrase the format.

Methods

static string escape(string $text)

Escapes "<" special char in given text.

__construct(Boolean $decorated = null, array $styles = array())

Initializes console output formatter.

setDecorated(Boolean $decorated)

Sets the decorated flag.

Boolean isDecorated()

Gets the decorated flag.

setStyle(string $name, OutputFormatterStyleInterface $style)

Sets a new style.

Boolean hasStyle(string $name)

Checks if output formatter has style with specified name.

OutputFormatterStyleInterface getStyle(string $name)

Gets style options from style with specified name.

string format(string $message)

Formats a message according to the given styles.

OutputFormatterStyleStack getStyleStack()

Details

at line 39
static public string escape(string $text)

Escapes "<" special char in given text.

Parameters

string $text Text to escape

Return Value

string Escaped text

at line 52
public __construct(Boolean $decorated = null, array $styles = array())

Initializes console output formatter.

Parameters

Boolean $decorated Whether this formatter should actually decorate strings
array $styles Array of "name => FormatterStyle" instances

at line 75
public setDecorated(Boolean $decorated)

Sets the decorated flag.

Parameters

Boolean $decorated Whether to decorate the messages or not

at line 87
public Boolean isDecorated()

Gets the decorated flag.

Return Value

Boolean true if the output will decorate messages, false otherwise

at line 100
public setStyle(string $name, OutputFormatterStyleInterface $style)

Sets a new style.

Parameters

string $name The style name
OutputFormatterStyleInterface $style The style instance

at line 114
public Boolean hasStyle(string $name)

Checks if output formatter has style with specified name.

Parameters

string $name

Return Value

Boolean

at line 130
public OutputFormatterStyleInterface getStyle(string $name)

Gets style options from style with specified name.

Parameters

string $name

Return Value

OutputFormatterStyleInterface

at line 148
public string format(string $message)

Formats a message according to the given styles.

Parameters

string $message The message to style

Return Value

string The styled message

at line 158
public OutputFormatterStyleStack getStyleStack()

Return Value

OutputFormatterStyleStack