Class ConsoleHelper

Summary

Fully Qualified Name: Zend\Stdlib\ConsoleHelper

Description

Utilities for console tooling.

Provides the following facilities:

Colorization will only occur when expected sequences are discovered, and then, only if the console terminal allows it.

Essentially, provides the bare minimum to allow you to provide messages to the current console.

Methods

Name Description Defined By
__construct() ConsoleHelper
colorize() Colorize a string for use with the terminal. ConsoleHelper
write() ConsoleHelper
writeErrorMessage() Emit an error message. ConsoleHelper
writeLine() ConsoleHelper

Method Details

__construct()

Parameter Name Type Description
$resource resource

Returns:

colorize()

Colorize a string for use with the terminal.

Takes strings formatted as <key>string</key> and formats them per the $highlightMap; if color support is disabled, simply removes the formatting tags.

Parameter Name Type Description
$string string

Returns: string

write()

Parameter Name Type Description
$string string
$colorize bool Whether
$resource resource Defaults

Returns: void

writeErrorMessage()

Emit an error message.

Wraps the message in <error></error>, and passes it to writeLine(), using STDERR as the resource; emits an additional empty line when done, also to STDERR.

Parameter Name Type Description
$message string

Returns: void

writeLine()

Parameter Name Type Description
$string string
$colorize bool Whether
$resource resource Defaults

Returns: void

Top