ConsoleFormatter
public abstract class ConsoleFormatter
| Constructor Summary | |
|---|---|
| void | Initialize formatter. |
| Method Summary | |
|---|---|
| final void | setTranslator(Translator translator) Set formatter translator. |
| protected abstract array | Returns default parameters to construct ParameterBag. |
| final Boolean | hasParameter(string name) Checks if current formatter has parameter. |
| final void | setParameter(string name, mixed value) Sets formatter parameter. |
| final mixed | getParameter(string name) Returns parameter value. |
| protected final string | getResultColorCode(integer result) Returns color code from tester result status code. |
| protected final void | write(string|array messages, Boolean newline) Writes message(s) to output console. |
| protected final void | writeln(string|array messages) Writes newlined message(s) to output console. |
| protected final StreamOutput | Returns console instance, prepared to write. |
| protected resource | Returns new output stream for console. |
| protected StreamOutput | Returns new output console. |
| protected void | configureOutputConsole(StreamOutput console) Configure output console parameters. |
| protected final void | Clear output console, so on next write formatter will need to init (create) it again. |
| protected final string | translate(string message, array parameters) Translates message to output language. |
| protected final string | translateChoice(string message, string number, array parameters) Translates numbered message to output language. |
| protected void | exceptionToString($exception \Exception, Exception exception) Creates a user-presentable string describing the given exception. |
public void __construct()
Initialize formatter.
public final void setTranslator(Translator translator)
Set formatter translator.
protected abstract array getDefaultParameters()
Returns default parameters to construct ParameterBag.
public final Boolean hasParameter(string name)
Checks if current formatter has parameter.
public final void setParameter(string name, mixed value)
Sets formatter parameter.
public final mixed getParameter(string name)
Returns parameter value.
protected final string getResultColorCode(integer result)
Returns color code from tester result status code.
protected final void write(string|array messages, Boolean newline)
Writes message(s) to output console.
protected final void writeln(string|array messages)
Writes newlined message(s) to output console.
protected final StreamOutput getWritingConsole()
Returns console instance, prepared to write.
protected resource createOutputStream()
Returns new output stream for console.
Override this method & call flushOutputConsole() to write output in another stream
protected StreamOutput createOutputConsole()
Returns new output console.
protected void configureOutputConsole(StreamOutput console)
Configure output console parameters.
protected final void flushOutputConsole()
Clear output console, so on next write formatter will need to init (create) it again.
protected final string translate(string message, array parameters)
Translates message to output language.
protected final string translateChoice(string message, string number, array parameters)
Translates numbered message to output language.
protected void exceptionToString($exception \Exception, Exception exception)
Creates a user-presentable string describing the given exception.
Console formatter.