| Methods |
public
|
__construct(OutputInterface $output)
|
#
|
public
static
|
setStyleDefinition(string $name, TableStyle $style): void
Sets a style definition.
|
#
|
public
static
|
getStyleDefinition(string $name): TableStyle
Gets a style definition by name.
Gets a style definition by name.
|
#
|
public
|
setStyle(TableStyle|string $name): $this
Sets table style.
|
#
|
public
|
getStyle(): TableStyle
Gets the current table style.
Gets the current table style.
|
#
|
public
|
setColumnStyle(int $columnIndex, TableStyle|string $name): $this
Sets table column style.
Parameters
| $name |
The style name or a TableStyle instance
|
|
#
|
public
|
getColumnStyle(int $columnIndex): TableStyle
Gets the current style for a column.
Gets the current style for a column.
If style was not set, it returns the global table style.
|
#
|
public
|
setColumnWidth(int $columnIndex, int $width): $this
Sets the minimum width of a column.
Sets the minimum width of a column.
|
#
|
public
|
setColumnWidths(array $widths): $this
Sets the minimum width of all columns.
Sets the minimum width of all columns.
|
#
|
public
|
setColumnMaxWidth(int $columnIndex, int $width): $this
Sets the maximum width of a column.
Sets the maximum width of a column.
Any cell within this column which contents exceeds the specified width will be wrapped into multiple lines, while
formatted strings are preserved.
|
#
|
public
|
setHeaders(array $headers): $this
|
#
|
public
|
setRows(array $rows): $this
|
#
|
public
|
addRows(array $rows): $this
|
#
|
public
|
addRow(TableSeparator|array $row): $this
|
#
|
public
|
appendRow(TableSeparator|array $row): $this
Adds a row to the table, and re-renders the table.
Adds a row to the table, and re-renders the table.
|
#
|
public
|
setRow(int|string $column, array $row): $this
|
#
|
public
|
setHeaderTitle(?string $title): $this
|
#
|
public
|
setFooterTitle(?string $title): $this
|
#
|
public
|
setHorizontal(bool $horizontal = true): $this
|
#
|
public
|
setVertical(bool $vertical = true): $this
|
#
|
public
|
render(): void
Renders table to output.
Renders table to output.
Example:
+---------------+-----------------------+------------------+
| ISBN | Title | Author |
+---------------+-----------------------+------------------+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
+---------------+-----------------------+------------------+
|
#
|
private
|
renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null): void
Renders horizontal header separator.
Renders horizontal header separator.
Example:
+-----+-----------+-------+
|
#
|
private
|
renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
Renders vertical column separator.
Renders vertical column separator.
|
#
|
private
|
renderRow(array $row, string $cellFormat, string $firstCellFormat = null): void
Renders table row.
Renders table row.
Example:
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
|
#
|
private
|
renderCell(array $row, int $column, string $cellFormat): string
Renders table cell with padding.
Renders table cell with padding.
|
#
|
private
|
calculateNumberOfColumns(array $rows): void
Calculate number of columns for this table.
Calculate number of columns for this table.
|
#
|
private
|
buildTableRows(array $rows): TableRows
|
#
|
private
|
calculateRowCount(): int
|
#
|
private
|
fillNextRows(array $rows, int $line): array
fill rows that contains rowspan > 1.
fill rows that contains rowspan > 1.
Throws
|
#
|
private
|
fillCells(iterable $row): iterable
fill cells for a row that contains colspan > 1.
fill cells for a row that contains colspan > 1.
|
#
|
private
|
copyRow(array $rows, int $line): array
|
#
|
private
|
getNumberOfColumns(array $row): int
Gets number of columns by row.
Gets number of columns by row.
|
#
|
private
|
getRowColumns(array $row): array
Gets list of columns for the given row.
Gets list of columns for the given row.
|
#
|
private
|
calculateColumnsWidth(iterable $groups): void
Calculates columns widths.
Calculates columns widths.
|
#
|
private
|
getColumnSeparatorWidth(): int
|
#
|
private
|
getCellWidth(array $row, int $column): int
|
#
|
private
|
cleanup(): void
Called after rendering to cleanup cache data.
Called after rendering to cleanup cache data.
|
#
|
private
static
|
initStyles(): array<string, TableStyle>
|
#
|
private
|
resolveStyle(TableStyle|string $name): TableStyle
|
#
|