RSI helpers  0.1
RSI helpers
Console Class Reference

Console helpers. More...

Static Public Member Functions

static readLine ()
 Read an input line. More...
 
static prompt ($message, $options=null, $default=null)
 Ask a question. More...
 
static header ($header, $width=80, $font=null, $pad=null)
 Large header text. More...
 
static block ($str, $width=80, $pad=null)
 Text block. More...
 
static gauge ($perc=0, $width=80)
 Text style gauge. More...
 
static table ($data, $columns=null, $width=80)
 Text style table. More...
 

Static Protected Member Functions

static tableRow ($record, $columns)
 

Detailed Description

Console helpers.

Definition at line 8 of file Console.php.

Member Function Documentation

◆ block()

static block (   $str,
  $width = 80,
  $pad = null 
)
static

Text block.

Parameters
string$strText.
int$widthWidth of block.
int$padPadding type (STR_PAD_* constants).
Returns
string Block with text.

Definition at line 97 of file Console.php.

◆ gauge()

static gauge (   $perc = 0,
  $width = 80 
)
static

Text style gauge.

Parameters
float$percPercentage done (0..100).
int$widthTotal width of gauche.
Returns
string

Definition at line 108 of file Console.php.

◆ header()

static header (   $header,
  $width = 80,
  $font = null,
  $pad = null 
)
static

Large header text.

Parameters
string$headerHeader.
int$widthMaximum width of header.
int$fontMaximum font size (1..5).
int$padPadding type (STR_PAD_* constants).
Returns
string Large header (multi line string) or simply $header if too wide.

Definition at line 41 of file Console.php.

◆ prompt()

static prompt (   $message,
  $options = null,
  $default = null 
)
static

Ask a question.

Parameters
string$messageMessage to show.
array | string$optionsArray with allowed options (key = input, value = explanation) or regex for the answer.
string$defaultDefault answer (when user presses enter).
Returns
string Answer.

Definition at line 25 of file Console.php.

◆ readLine()

static readLine ( )
static

Read an input line.

Returns
string User input (excluding the last return).

Definition at line 14 of file Console.php.

◆ table()

static table (   $data,
  $columns = null,
  $width = 80 
)
static

Text style table.

Parameters
array$dataArray of records.
array$columnsKey = same as records, value = array with (optional) 'header' (defaults to key), 'width' (defaults to null = auto), 'pad' = STR_PAD_RIGHT (default), STR_PAD_LEFT, or STR_PAD_BOTH. Empty = take keys of first record.
int$widthMaximum width of complete table (including borders).
Returns
string

Definition at line 136 of file Console.php.

◆ tableRow()

static tableRow (   $record,
  $columns 
)
staticprotected

Definition at line 115 of file Console.php.


The documentation for this class was generated from the following file: