Text UI
A simple and fast way to take user input and display output in text mode using PHP.
|
Public Member Functions | |
__construct (array $data) | |
draw () | |
setHeader (array $header) | |
setFooter (array $footer) | |
setColWidths (array $widths) | |
setHorizontalAlignements (array $alignements) | |
setIntersectionChar (string $char) | |
setSimpleHorizontalBorderChar (string $char) | |
setSimpleVerticalBorderChar (string $char) | |
setSpecialHorizontalBorderChar (string $char) | |
Public Member Functions inherited from DrawableInterface |
Protected Member Functions | |
buildFooterStr (array $footer, array $colsLen, array $align) | |
buildHeaderStr (array $header, array $colsLen, array $align) | |
buildBodyStr (array $bodyData, array $colsLen, array $align) | |
getAlign (int $colIndex, array $align) | |
calcMaxParagraphByRow (array $row) | |
splitCells (array $data, array $colsLen) | |
buildBodyHorizontalSeparatorStr (array $colsLen) | |
buildHeaderHorizontalSeparatorStr (array $colsLen) | |
calcColsLen (array $data, array $width=[]) | |
calcColsLenFromData (array $data) | |
calcColsLenFromWidth (array $width) | |
Protected Attributes | |
string | $intersectionChar = '+' |
string | $simpleHorizontalBorderChar = '-' |
string | $verticalBorderChar = '|' |
string | $specialHorizontalBorderChar = '=' |
readonly array | $data |
array | $header = [] |
array | $footer = [] |
array | $width = [] |
array | $align = [] |
Draws a table for displaying tabular data, with support for header, footer, alignment, and column sizes.
__construct | ( | array | $data | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
draw | ( | ) |
|
protected |
setColWidths | ( | array | $widths | ) |
Sets the column widths.
Values can be expressed in whole numbers representing parts of the whole or in decimals representing percentages.
array<int> | $widths The widths of each column, as many as there are columns of data. |
InvalidArgumentException |
setFooter | ( | array | $footer | ) |
setHeader | ( | array | $header | ) |
setHorizontalAlignements | ( | array | $alignements | ) |
Sets the horizontal alignment (center, right, or left - the default) of cell contents, including the header and footer.
It is not necessary to indicate alignment for all columns. Columns are identified by the 0-indexed key according to the order in which they appear in the data.
array<int> | $alignements Array of TextUI\Enum\HAlign |
setIntersectionChar | ( | string | $char | ) |
setSimpleHorizontalBorderChar | ( | string | $char | ) |
setSimpleVerticalBorderChar | ( | string | $char | ) |
setSpecialHorizontalBorderChar | ( | string | $char | ) |
|
protected |