package Default

 Methods

Clear console screen

clear() : void

Clear line at cursor position

clearLine() : void

Clear console screen

clearScreen() : void

Prepare a string that will be rendered in color.

colorize(string $string, null|integer $color = null, null|integer $bgColor = null) : string

Parameters

$string

string

$color

nullinteger

Foreground color

$bgColor

nullinteger

Background color

Returns

string

Get charset currently in use by this adapter.

getCharset() : \Zend\Console\Charset\CharsetInterface

Returns

\Zend\Console\Charset\CharsetInterface$charset

getDefaultCharset()

getDefaultCharset() : \Zend\Console\Charset\CharsetInterface

Returns

\Zend\Console\Charset\CharsetInterface

Determine and return current console height.

getHeight() : integer

Returns

integer

Determine and return current console width and height.

getSize() : array

Returns

arrayarray($width, $height)

Return current console window title.

getTitle() : string

Returns

string

Determine and return current console width.

getWidth() : integer

Returns

integer

Hide console cursor

hideCursor() : void

Check if console is UTF-8 compatible

isUtf8() : boolean

Returns

boolean

Read a single character from the console input

readChar(string|null $mask = null) : string

Parameters

$mask

stringnull

A list of allowed chars

Returns

string

Read a single line from the console input

readLine(integer $maxLength = 2048) : string

Parameters

$maxLength

integer

Maximum response length

Returns

string

Reset color to console default.

resetColor() : void

Change current drawing background color

setBgColor(integer $color) : void

Parameters

$color

integer

Set Console charset to use.

setCharset(\Zend\Console\Charset\CharsetInterface $charset) : void

Parameters

$charset

\Zend\Console\Charset\CharsetInterface

Change current drawing color.

setColor(integer $color) : void

Parameters

$color

integer

Set cursor position

setPos(integer $x, integer $y) : void

Parameters

$x

integer

$y

integer

Show console cursor

showCursor() : void

Write a chunk of text to console.

write(string $text, null|integer $color = null, null|integer $bgColor = null) : void

Parameters

$text

string

$color

nullinteger

$bgColor

nullinteger

Write a piece of text at the coordinates of $x and $y

writeAt(string $text, integer $x, integer $y, null|integer $color = null, null|integer $bgColor = null) : void

Parameters

$text

string

Text to write

$x

integer

Console X coordinate (column)

$y

integer

Console Y coordinate (row)

$color

nullinteger

$bgColor

nullinteger

Write a box at the specified coordinates.

writeBox(integer $x1, integer $y1, integer $x2, integer $y2, integer $lineStyle = self::LINE_SINGLE, integer $fillStyle = self::FILL_NONE, integer $color = null, integer $bgColor = null, null|integer $fillColor = null, null|integer $fillBgColor = null) : void

If X or Y coordinate value is negative, it will be calculated as the distance from far right or bottom edge of the console (respectively).

Parameters

$x1

integer

Top-left corner X coordinate (column)

$y1

integer

Top-left corner Y coordinate (row)

$x2

integer

Bottom-right corner X coordinate (column)

$y2

integer

Bottom-right corner Y coordinate (row)

$lineStyle

integer

(optional) Box border style.

$fillStyle

integer

(optional) Box fill style or a single character to fill it with.

$color

integer

(optional) Foreground color

$bgColor

integer

(optional) Background color

$fillColor

nullinteger

(optional) Foreground color of box fill

$fillBgColor

nullinteger

(optional) Background color of box fill

Write a single line of text to console and advance cursor to the next line.

writeLine(string $text = "", null|integer $color = null, null|integer $bgColor = null) : void

If the text is longer than console width it will be truncated.

Parameters

$text

string

$color

nullinteger

$bgColor

nullinteger

Alias for write()

writeText(string $text, null|integer $color = null, null|integer $bgColor = null) : void

Parameters

$text

string

$color

nullinteger

$bgColor

nullinteger

Write a block of text at the given coordinates, matching the supplied width and height.

writeTextBlock(string $text, integer $width, integer|null $height = null, integer $x = 0, integer $y = 0, null|integer $color = null, null|integer $bgColor = null) : void

In case a line of text does not fit desired width, it will be wrapped to the next line. In case the whole text does not fit in desired height, it will be truncated.

Parameters

$text

string

Text to write

$width

integer

Maximum block width. Negative value means distance from right edge.

$height

integernull

Maximum block height. Negative value means distance from bottom edge.

$x

integer

Block X coordinate (column)

$y

integer

Block Y coordinate (row)

$color

nullinteger

(optional) Text color

$bgColor

nullinteger

(optional) Text background color

 Constants

 

FILL_BLOCK

FILL_BLOCK = 10 
 

FILL_NONE

FILL_NONE = 0 
 

FILL_SHADE_DARK

FILL_SHADE_DARK = 3 
 

FILL_SHADE_LIGHT

FILL_SHADE_LIGHT = 1 
 

FILL_SHADE_MEDIUM

FILL_SHADE_MEDIUM = 2 
 

LINE_BLOCK

LINE_BLOCK = 4 
 

LINE_DOUBLE

LINE_DOUBLE = 3 
 

LINE_NONE

LINE_NONE = 1 
 

LINE_SINGLE

LINE_SINGLE = 2