Common console adapter codebase

package Default

 Methods

Clear console screen

clear() 
inherited_from \Zend\Console\Adapter\AdapterInterface::clear()

Clear line at cursor position

clearLine() 
inherited_from \Zend\Console\Adapter\AdapterInterface::clearLine()

Clear console screen

clearScreen() 
inherited_from \Zend\Console\Adapter\AdapterInterface::clearScreen()

Prepare a string that will be rendered in color.

colorize(string $string, integer $color = null, null|integer $bgColor = null) : string
inherited_from \Zend\Console\Adapter\AdapterInterface::colorize()

Parameters

$string

string

$color

integer

$bgColor

nullinteger

Returns

string

Encode a text to match console encoding

encodeText(string $text) : string

Parameters

$text

string

Returns

stringthe encoding text

Get charset currently in use by this adapter.

getCharset() : \Zend\Console\Charset\CharsetInterface
inherited_from \Zend\Console\Adapter\AdapterInterface::getCharset()

Returns

\Zend\Console\Charset\CharsetInterface$charset

getDefaultCharset()

getDefaultCharset() : \Zend\Console\Charset\Utf8
inherited_from \Zend\Console\Adapter\AdapterInterface::getDefaultCharset()

Returns

\Zend\Console\Charset\Utf8

Determine and return current console height.

getHeight() : integer
inherited_from \Zend\Console\Adapter\AdapterInterface::getHeight()

Returns

integer

Determine and return current console width and height.

getSize() : array<mixed,integer>
inherited_from \Zend\Console\Adapter\AdapterInterface::getSize()

Returns

array<mixed,integer>array($width, $height)

Return current console window title.

getTitle() : string
inherited_from \Zend\Console\Adapter\AdapterInterface::getTitle()

Returns

string

Determine and return current console width.

getWidth() : integer
inherited_from \Zend\Console\Adapter\AdapterInterface::getWidth()

Returns

integer

Hide console cursor

hideCursor() 
inherited_from \Zend\Console\Adapter\AdapterInterface::hideCursor()

Check if console is UTF-8 compatible

isUtf8() : boolean
inherited_from \Zend\Console\Adapter\AdapterInterface::isUtf8()

Returns

boolean

Read a single character from the console input

readChar(string|null $mask = null) : string
inherited_from \Zend\Console\Adapter\AdapterInterface::readChar()

Parameters

$mask

stringnull

A list of allowed chars

Returns

string

Read a single line from the console input

readLine(integer $maxLength = 2048) : string
inherited_from \Zend\Console\Adapter\AdapterInterface::readLine()

Parameters

$maxLength

integer

Maximum response length

Returns

string

Reset color to console default.

resetColor() 
inherited_from \Zend\Console\Adapter\AdapterInterface::resetColor()

Change current drawing background color

setBgColor(integer $color) 
inherited_from \Zend\Console\Adapter\AdapterInterface::setBgColor()

Parameters

$color

integer

Set Console charset to use.

setCharset(\Zend\Console\Charset\CharsetInterface $charset) 
inherited_from \Zend\Console\Adapter\AdapterInterface::setCharset()

Parameters

$charset

\Zend\Console\Charset\CharsetInterface

Change current drawing color.

setColor(integer $color) 
inherited_from \Zend\Console\Adapter\AdapterInterface::setColor()

Parameters

$color

integer

Set cursor position

setPos(integer $x, integer $y) 
inherited_from \Zend\Console\Adapter\AdapterInterface::setPos()

Parameters

$x

integer

$y

integer

Show console cursor

showCursor() 
inherited_from \Zend\Console\Adapter\AdapterInterface::showCursor()

Write a chunk of text to console.

write(string $text, null|integer $color = null, null|integer $bgColor = null
inherited_from \Zend\Console\Adapter\AdapterInterface::write()

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
inherited_from \Zend\Console\Adapter\AdapterInterface::writeAt()

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

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).

inherited_from \Zend\Console\Adapter\AdapterInterface::writeBox()

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

Exceptions

\Zend\Console\Exception\BadMethodCallException if coordinates are invalid

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

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

inherited_from \Zend\Console\Adapter\AdapterInterface::writeLine()

Parameters

$text

string

$color

nullinteger

$bgColor

nullinteger

Alias for write()

writeText(string $text, null|integer $color = null, null|integer $bgColor = null
inherited_from \Zend\Console\Adapter\AdapterInterface::writeText()

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

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.

inherited_from \Zend\Console\Adapter\AdapterInterface::writeTextBlock()

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

Exceptions

\Zend\Console\Exception\InvalidArgumentException

 Properties

 

$charset

$charset : \Zend\Console\Charset\CharsetInterface

Default

 

Whether or not mbstring is enabled

$hasMBString : null | boolean

Default

Static
 

Current cursor X position

$posX : integer

Default

 

Current cursor Y position

$posY : integer

Default