PHP Class PHPDaemon\Utils\Terminal

Author: Vasily Zorin ([email protected])
Inheritance: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
Datei anzeigen Open project: kakserpom/phpdaemon Class Usage Examples

Protected Properties

Property Type Description
$columns Maximum terminal width
$enableColor Is color allowed in terminal?

Public Methods

Method Description
__construct ( ) Constructor
clearScreen ( ) : void Clear the terminal with CLR
drawParam ( string $name, string $description, array $values = '' ) : void Draw param (like in man)
drawTable ( $rows ) : void Draw a table
enableColor ( boolean $bool = true ) : void Enables/disable color
readln ( ) : string Read a line from STDIN
resetStyle ( ) : void Reset style to default
setStyle ( string $c ) : void Set text style

Protected Methods

Method Description
getMaxColumns ( ) : integer Counting terminal char width

Method Details

__construct() public method

Constructor
public __construct ( )

clearScreen() public method

Clear the terminal with CLR
public clearScreen ( ) : void
return void

drawParam() public method

Draw param (like in man)
public drawParam ( string $name, string $description, array $values = '' ) : void
$name string Param name
$description string Param description
$values array Param allowed values
return void

drawTable() public method

Draw a table
public drawTable ( $rows ) : void
return void

enableColor() public method

Enables/disable color
public enableColor ( boolean $bool = true ) : void
$bool boolean Enable?
return void

getMaxColumns() protected method

Counting terminal char width
protected getMaxColumns ( ) : integer
return integer

readln() public method

Read a line from STDIN
public readln ( ) : string
return string Line

resetStyle() public method

Reset style to default
public resetStyle ( ) : void
return void

setStyle() public method

Set text style
public setStyle ( string $c ) : void
$c string Style
return void

Property Details

$columns protected_oe property

Maximum terminal width
protected $columns

$enableColor protected_oe property

Is color allowed in terminal?
protected $enableColor