Console helpers.
More...
|
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...
|
|
Console helpers.
Definition at line 8 of file Console.php.
◆ block()
static block |
( |
|
$str, |
|
|
|
$width = 80 , |
|
|
|
$pad = null |
|
) |
| |
|
static |
Text block.
- Parameters
-
string | $str | Text. |
int | $width | Width of block. |
int | $pad | Padding 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 | $perc | Percentage done (0..100). |
int | $width | Total 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 | $header | Header. |
int | $width | Maximum width of header. |
int | $font | Maximum font size (1..5). |
int | $pad | Padding 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 | $message | Message to show. |
array | string | $options | Array with allowed options (key = input, value = explanation) or regex for the answer. |
string | $default | Default answer (when user presses enter). |
- Returns
- string Answer.
Definition at line 25 of file Console.php.
◆ readLine()
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 | $data | Array of records. |
array | $columns | Key = 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 | $width | Maximum width of complete table (including borders). |
- Returns
- string
Definition at line 136 of file Console.php.
◆ tableRow()
static tableRow |
( |
|
$record, |
|
|
|
$columns |
|
) |
| |
|
staticprotected |
The documentation for this class was generated from the following file:
- /var/www/fred.local/vendor/rsi/helpers/src/Rsi/Console.php