Table
class Table
Table helper.
Properties
protected Output | $output | Output instance. | |
protected FormatterInterface|null | $formatter | Formatter instance. |
Methods
bool
isValidInput(array $columnNames, array $rows)
Checks if the number of cells in each row matches the number of columns.
string
stringWidthWithoutFormatting(string $string)
Returns the width of the string without formatting.
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
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 84
protected string
stringWidthWithoutFormatting(string $string)
Returns the width of the string without formatting.
at line 96
protected array
getColumnWidths(array $columnNames, array $rows)
Returns an array containing the maximum width of each column.
at line 134
protected string
buildRowSeparator(array $columnWidths, string $separator = '-')
Builds a row separator.
at line 148
protected string
buildTableRow(array $colums, array $columnWidths)
Builds a table row.
at line 167
string
render(array $columnNames, array $rows)
Renders a table.
at line 207
draw(array $columnNames, array $rows, int $writer = Output::STANDARD)
Draws a table.