sfAnsiColorFormatter provides methods to colorize text to be displayed on a
console.
Method Summary
-
string
excerpt($text, $size = null)
Truncates a line.
-
string
format($text = '', $parameters = array(), $stream = STDOUT)
Formats a text according to the given style or parameters.
-
formatSection($section, $text, $size = null, $style = 'INFO')
Formats a message within a section.
-
setStyle($name, $options = array())
Sets a new style.
-
Boolean
supportsColors($stream)
Returns true if the stream supports colorization.
Methods inherited from sfFormatter
excerpt , format , formatSection , setMaxLineSize , __construct
Method Details
-
(string) excerpt ($text, $size = null)
Browse code
| $text |
The text
|
| $size |
The maximum size of the returned string (65 by default)
|
Truncates a line.
returns The truncated string
-
(string) format ($text = '', $parameters = array(), $stream = STDOUT)
Browse code
| $text |
The test to style
|
| $parameters |
An array of options or a style name
|
| $stream |
The stream to format for
|
Formats a text according to the given style or parameters.
returns The styled text
-
formatSection ($section, $text, $size = null, $style = 'INFO')
Browse code
| $section |
The section name
|
| $text |
The text message
|
| $size |
The maximum size allowed for a line (65 by default)
|
| $style |
The color scheme to apply to the section string (INFO, ERROR, or COMMAND)
|
Formats a message within a section.
-
setStyle ($name, $options = array())
Browse code
| $name |
The style name
|
| $options |
An array of options
|
Sets a new style.
-
(Boolean) supportsColors ($stream)
Browse code
Returns true if the stream supports colorization.
Colorization is disabled if not supported by the stream:
returns true if the stream supports colorization, false otherwise
|