Zend Framework  3.0
Public Member Functions | Public Attributes | List of all members
AdapterInterface Interface Reference

Public Member Functions

 write ($text, $color=null, $bgColor=null)
 Write a chunk of text to console.
 
 writeText ($text, $color=null, $bgColor=null)
 Alias for write()
 
 writeLine ($text="", $color=null, $bgColor=null)
 Write a single line of text to console and advance cursor to the next line.
 
 writeAt ($text, $x, $y, $color=null, $bgColor=null)
 Write a piece of text at the coordinates of $x and $y.
 
 writeBox ($x1, $y1, $x2, $y2, $lineStyle=self::LINE_SINGLE, $fillStyle=self::FILL_NONE, $color=null, $bgColor=null, $fillColor=null, $fillBgColor=null)
 Write a box at the specified coordinates.
 
 writeTextBlock ($text, $width, $height=null, $x=0, $y=0, $color=null, $bgColor=null)
 Write a block of text at the given coordinates, matching the supplied width and height.
 
 getWidth ()
 Determine and return current console width.
 
 getHeight ()
 Determine and return current console height.
 
 getSize ()
 Determine and return current console width and height.
 
 isUtf8 ()
 Check if console is UTF-8 compatible.
 
 setPos ($x, $y)
 Set cursor position.
 
 hideCursor ()
 Hide console cursor.
 
 showCursor ()
 Show console cursor.
 
 getTitle ()
 Return current console window title.
 
 colorize ($string, $color=null, $bgColor=null)
 Prepare a string that will be rendered in color.
 
 setColor ($color)
 Change current drawing color.
 
 setBgColor ($color)
 Change current drawing background color.
 
 resetColor ()
 Reset color to console default.
 
 setCharset (CharsetInterface $charset)
 Set Console charset to use.
 
 getCharset ()
 Get charset currently in use by this adapter.
 
 getDefaultCharset ()
 
 clear ()
 Clear console screen.
 
 clearLine ()
 Clear line at cursor position.
 
 clearScreen ()
 Clear console screen.
 
 readLine ($maxLength=2048)
 Read a single line from the console input.
 
 readChar ($mask=null)
 Read a single character from the console input.
 

Public Attributes

const LINE_NONE = 1
 
const LINE_SINGLE = 2
 
const LINE_DOUBLE = 3
 
const LINE_BLOCK = 4
 
const FILL_NONE = 0
 
const FILL_SHADE_LIGHT = 1
 
const FILL_SHADE_MEDIUM = 2
 
const FILL_SHADE_DARK = 3
 
const FILL_BLOCK = 10
 

Member Function Documentation

clear ( )

Clear console screen.

Returns
void

Implemented in AbstractAdapter, Posix, Windows, and WindowsAnsicon.

clearLine ( )

Clear line at cursor position.

Returns
void

Implemented in AbstractAdapter, Windows, and WindowsAnsicon.

clearScreen ( )

Clear console screen.

Returns
void

Implemented in AbstractAdapter.

colorize (   $string,
  $color = null,
  $bgColor = null 
)

Prepare a string that will be rendered in color.

Parameters
string$string
null | int$colorForeground color
null | int$bgColorBackground color
Returns
string

Implemented in AbstractAdapter, and Posix.

getCharset ( )

Get charset currently in use by this adapter.

Returns
CharsetInterface $charset

Implemented in AbstractAdapter, Posix, Windows, WindowsAnsicon, and Virtual.

getDefaultCharset ( )
Returns
CharsetInterface

Implemented in AbstractAdapter, Posix, Windows, WindowsAnsicon, and Virtual.

getHeight ( )

Determine and return current console height.

Returns
int

Implemented in AbstractAdapter, Posix, WindowsAnsicon, Windows, and Virtual.

getSize ( )

Determine and return current console width and height.

Returns
array array($width, $height)

Implemented in AbstractAdapter.

getTitle ( )

Return current console window title.

Returns
string

Implemented in AbstractAdapter, Windows, WindowsAnsicon, and Virtual.

getWidth ( )

Determine and return current console width.

Returns
int

Implemented in AbstractAdapter, Posix, WindowsAnsicon, Windows, and Virtual.

hideCursor ( )

Hide console cursor.

Returns
void

Implemented in AbstractAdapter, and Posix.

isUtf8 ( )

Check if console is UTF-8 compatible.

Returns
bool

Implemented in AbstractAdapter, Posix, Windows, WindowsAnsicon, and Virtual.

readChar (   $mask = null)

Read a single character from the console input.

Parameters
string | null$maskA list of allowed chars
Returns
string

Implemented in AbstractAdapter, Posix, Windows, and WindowsAnsicon.

readLine (   $maxLength = 2048)

Read a single line from the console input.

Parameters
int$maxLengthMaximum response length
Returns
string

Implemented in AbstractAdapter, and Windows.

resetColor ( )

Reset color to console default.

Returns
void

Implemented in AbstractAdapter, and Posix.

setBgColor (   $color)

Change current drawing background color.

Parameters
int$color
Returns
void

Implemented in AbstractAdapter, and Posix.

setCharset ( CharsetInterface  $charset)

Set Console charset to use.

Parameters
CharsetInterface$charset
Returns
void

Implemented in WindowsAnsicon.

setColor (   $color)

Change current drawing color.

Parameters
int$color
Returns
void

Implemented in AbstractAdapter, and Posix.

setPos (   $x,
  $y 
)

Set cursor position.

Parameters
int$x
int$y
Returns
void

Implemented in AbstractAdapter, and Posix.

showCursor ( )

Show console cursor.

Returns
void

Implemented in AbstractAdapter, and Posix.

write (   $text,
  $color = null,
  $bgColor = null 
)

Write a chunk of text to console.

Parameters
string$text
null | int$color
null | int$bgColor
Returns
void

Implemented in AbstractAdapter.

writeAt (   $text,
  $x,
  $y,
  $color = null,
  $bgColor = null 
)

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

Parameters
string$textText to write
int$xConsole X coordinate (column)
int$yConsole Y coordinate (row)
null | int$color
null | int$bgColor
Returns
void

Implemented in AbstractAdapter.

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

Write a box at the specified coordinates.

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
int$x1Top-left corner X coordinate (column)
int$y1Top-left corner Y coordinate (row)
int$x2Bottom-right corner X coordinate (column)
int$y2Bottom-right corner Y coordinate (row)
int$lineStyle(optional) Box border style.
int$fillStyle(optional) Box fill style or a single character to fill it with.
int$color(optional) Foreground color
int$bgColor(optional) Background color
null | int$fillColor(optional) Foreground color of box fill
null | int$fillBgColor(optional) Background color of box fill
Returns
void

Implemented in AbstractAdapter.

writeLine (   $text = "",
  $color = null,
  $bgColor = null 
)

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

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

Parameters
string$text
null | int$color
null | int$bgColor
Returns
void

Implemented in Posix, and AbstractAdapter.

writeText (   $text,
  $color = null,
  $bgColor = null 
)

Alias for write()

Parameters
string$text
null | int$color
null | int$bgColor
Returns
void

Implemented in AbstractAdapter.

writeTextBlock (   $text,
  $width,
  $height = null,
  $x = 0,
  $y = 0,
  $color = null,
  $bgColor = null 
)

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

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
string$textText to write
int$widthMaximum block width. Negative value means distance from right edge.
int | null$heightMaximum block height. Negative value means distance from bottom edge.
int$xBlock X coordinate (column)
int$yBlock Y coordinate (row)
null | int$color(optional) Text color
null | int$bgColor(optional) Text background color
Returns
void

Implemented in AbstractAdapter.

Member Data Documentation

const FILL_BLOCK = 10
const FILL_NONE = 0
const FILL_SHADE_DARK = 3
const FILL_SHADE_LIGHT = 1
const FILL_SHADE_MEDIUM = 2
const LINE_BLOCK = 4
const LINE_DOUBLE = 3
const LINE_NONE = 1
const LINE_SINGLE = 2