ColorProcessor

Implements ProcessorInterface

Command line output processor supporting ANSI-colored output

deprecated
since

4.0.0

deprecated

5.0 Use the joomla/console package instead

package

Application

Methods

__construct

Class constructor

__construct(bool noColors = null) : mixed
since

4.0.0

Arguments

noColors

boolDefines non-colored mode on construct

Response

mixed

addPredefinedStyles

Adds predefined color styles to the ColorProcessor object

addPredefinedStyles() : $this
since

4.0.0

Response

$this

addStyle

Add a style.

addStyle(string name, \Joomla\CMS\Application\CLI\ColorStyle style) : $this
since

4.0.0

Arguments

name

stringThe style name.

style

\Joomla\CMS\Application\CLI\ColorStyleThe color style.

Response

$this

process

Process a string.

process(string string) : string
since

4.0.0

Arguments

string

stringThe string to process.

Response

string

replaceColors

Replace color tags in a string.

replaceColors(string text, string tag, string match, \Joomla\CMS\Application\CLI\ColorStyle style) : mixed
since

4.0.0

Arguments

text

stringThe original text.

tag

stringThe matched tag.

match

stringThe match.

style

\Joomla\CMS\Application\CLI\ColorStyleThe color style to apply.

Response

mixed

stripColors

Strip color tags from a string.

stripColors(string string) : string
static
since

4.0.0

Arguments

string

stringThe string.

Response

string

Properties

noColors

Flag to remove color codes from the output

since

4.0.0

Type(s)

bool

tagFilter

Regex to match tags

since

4.0.0

Type(s)

string

stripFilter

Regex used for removing color codes

static
since

4.0.0

Type(s)

string

styles

Array of ColorStyle objects

since

4.0.0

Type(s)

ColorStyle[]