class Table

Provides helpers to display a table.

Methods

__construct(OutputInterface $output)

No description

static 
setStyleDefinition(string $name, TableStyle $style)

Sets a style definition.

static TableStyle
getStyleDefinition(string $name)

Gets a style definition by name.

setStyle(TableStyle|string $name)

Sets table style.

getStyle()

Gets the current table style.

setColumnStyle(int $columnIndex, TableStyle|string $name)

Sets table column style.

getColumnStyle(int $columnIndex)

Gets the current style for a column.

setHeaders(array $headers)

No description

setRows(array $rows)

No description

addRows(array $rows)

No description

addRow($row)

No description

setRow($column, array $row)

No description

render()

Renders table to output.

Details

at line line 72
__construct(OutputInterface $output)

Parameters

OutputInterface $output

at line line 89
static setStyleDefinition(string $name, TableStyle $style)

Sets a style definition.

Parameters

string $name The style name
TableStyle $style A TableStyle instance

at line line 105
static TableStyle getStyleDefinition(string $name)

Gets a style definition by name.

Parameters

string $name The style name

Return Value

TableStyle A TableStyle instance

at line line 125
Table setStyle(TableStyle|string $name)

Sets table style.

Parameters

TableStyle|string $name The style name or a TableStyle instance

Return Value

Table

at line line 143
TableStyle getStyle()

Gets the current table style.

Return Value

TableStyle

at line line 156
Table setColumnStyle(int $columnIndex, TableStyle|string $name)

Sets table column style.

Parameters

int $columnIndex Column index
TableStyle|string $name The style name or a TableStyle instance

Return Value

Table

at line line 180
TableStyle getColumnStyle(int $columnIndex)

Gets the current style for a column.

If style was not set, it returns the global table style.

Parameters

int $columnIndex Column index

Return Value

TableStyle

at line line 189
setHeaders(array $headers)

Parameters

array $headers

at line line 201
setRows(array $rows)

Parameters

array $rows

at line line 208
addRows(array $rows)

Parameters

array $rows

at line line 217
addRow($row)

Parameters

$row

at line line 234
setRow($column, array $row)

Parameters

$column
array $row

at line line 253
render()

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 | +---------------+-----------------------+------------------+