Table
class Table
Table helper.
Traits
Helper trait.
Properties
protected FormatterInterface|null | $formatter | Formatter. | |
protected Output | $output | Output instance. |
Methods
int
stringWidthWithoutFormatting(string $string)
Returns the width of the string without formatting.
from HelperTrait
bool
isValidInput(array $columnNames, array $rows)
Checks if the number of cells in each row matches the number of columns.
array
getColumnWidths(array $columnNames, array $rows)
Returns an array containing the maximum width of each column.
string
buildRowSeparator(array $columnWidths, string $separator = '-')
Builds a row separator.
string
buildTableRow(array $colums, array $columnWidths)
Builds a table row.
string
render(array $columnNames, array $rows)
Renders a table.
draw(array $columnNames, array $rows, int $writer = Output::STANDARD)
Draws a table.
Details
in HelperTrait at line 25
protected int
stringWidthWithoutFormatting(string $string)
Returns the width of the string without formatting.
at line 46
__construct(Output $output)
Constructor.
at line 60
protected bool
isValidInput(array $columnNames, array $rows)
Checks if the number of cells in each row matches the number of columns.
at line 85
protected array
getColumnWidths(array $columnNames, array $rows)
Returns an array containing the maximum width of each column.
at line 123
protected string
buildRowSeparator(array $columnWidths, string $separator = '-')
Builds a row separator.
at line 137
protected string
buildTableRow(array $colums, array $columnWidths)
Builds a table row.
at line 156
string
render(array $columnNames, array $rows)
Renders a table.
at line 194
draw(array $columnNames, array $rows, int $writer = Output::STANDARD)
Draws a table.