class Doctrine_Cli_AnsiColorFormatter extends Doctrine_Cli_Formatter (View source)

Doctrine_AnsiColorFormatter provides methods to colorize text to be displayed on a console.

This class was taken from the symfony-project source

Properties

protected $_size from Doctrine_Cli_Formatter
protected $_styles
protected $_options
protected $_foreground
protected $_background

Methods

void
__construct(string $maxLineSize = 65)

__construct

string
format(string $text = '', mixed $parameters = array(), stream $stream = STDOUT)

Formats a text according to the given style or parameters.

formatSection(string $section, string $text, integer $size = null)

Formats a message within a section.

string
excerpt(string $text, integer $size = null)

Truncates a line.

setMaxLineSize(integer $size)

Sets the maximum line size.

setStyle(string $name, array $options = array())

Sets a new style.

Boolean
supportsColors(mixed $stream)

Returns true if the stream supports colorization.

Details

void __construct(string $maxLineSize = 65)

__construct

Parameters

string $maxLineSize

Return Value

void

string format(string $text = '', mixed $parameters = array(), stream $stream = STDOUT)

Formats a text according to the given style or parameters.

Parameters

string $text The test to style
mixed $parameters An array of parameters
stream $stream A stream (default to STDOUT)

Return Value

string The formatted text

formatSection(string $section, string $text, integer $size = null)

Formats a message within a section.

Parameters

string $section The section name
string $text The text message
integer $size The maximum size allowed for a line (65 by default)

string excerpt(string $text, integer $size = null)

Truncates a line.

Parameters

string $text The text
integer $size The maximum size of the returned string (65 by default)

Return Value

string The truncated string

setMaxLineSize(integer $size)

Sets the maximum line size.

Parameters

integer $size The maximum line size for a message

setStyle(string $name, array $options = array())

Sets a new style.

Parameters

string $name The style name
array $options An array of options

Boolean supportsColors(mixed $stream)

Returns true if the stream supports colorization.

Colorization is disabled if not supported by the stream:

  • windows
  • non tty consoles

Parameters

mixed $stream A stream

Return Value

Boolean true if the stream supports colorization, false otherwise