class CLI

Class to facilitate command-line output.

Support less-trivial output stuff such as colours (on xterm-color)

Methods

static 
supports_colour()

Returns true if the current STDOUT supports the use of colour control codes.

static string
text(string $text, string $fgColour = null, string $bgColour = null, bool $bold = false)

Return text encoded for CLI output, optionally coloured

static string
start_colour(string $fgColour = null, string $bgColour = null, bool $bold = false)

Send control codes for changing text to the given colour

static 
end_colour()

Send control codes for returning to normal colour

Details

at line 14
static supports_colour()

Returns true if the current STDOUT supports the use of colour control codes.

at line 38
static string text(string $text, string $fgColour = null, string $bgColour = null, bool $bold = false)

Return text encoded for CLI output, optionally coloured

Parameters

string $text
string $fgColour The foreground colour - black, red, green, yellow, blue, magenta, cyan, white. Null is default.
string $bgColour The foreground colour - black, red, green, yellow, blue, magenta, cyan, white. Null is default.
bool $bold A boolean variable - bold or not.

Return Value

string

at line 63
static string start_colour(string $fgColour = null, string $bgColour = null, bool $bold = false)

Send control codes for changing text to the given colour

Parameters

string $fgColour The foreground colour - black, red, green, yellow, blue, magenta, cyan, white. Null is default.
string $bgColour The foreground colour - black, red, green, yellow, blue, magenta, cyan, white. Null is default.
bool $bold A boolean variable - bold or not.

Return Value

string

at line 99
static end_colour()

Send control codes for returning to normal colour