API Documentation (v0.9.0-alpha)

Avolutions\Console\ConsoleTable

Helper to create tables for Console output.

Methods

Method Visibility Description
__construct() public Creates and initializes a new ConsoleTable instance.
addRow() public Adds an array with row values.
addRows() public Adds multiple rows to the table.
render() public Displays the table to the Console output.
setHeader() public Set the header columns for the table.

Method Details

__construct()

Creates and initializes a new ConsoleTable instance.

public __construct(Console $Console[, array<string|int, mixed> $rows = [] ][, bool $useFirstRowAsHeader = true ]) : mixed
Parameters

Console $Console
Console instance for output.

array<string|int, mixed> $rows (optional)
Multidimensional array with row values.

bool $useFirstRowAsHeader (optional)
First row is used as header (true) or not (false).

addRow()

Adds an array with row values.

public addRow(array<string|int, mixed> $row) : void
Parameters

array<string|int, mixed> $row
Array with row values.

Return values
void Adds an array with row values.
addRows()

Adds multiple rows to the table.

public addRows(array<string|int, mixed> $rows) : void
Parameters

array<string|int, mixed> $rows
Multidimensional array with row values.

Return values
void Adds multiple rows to the table.
render()

Displays the table to the Console output.

public render([array<string|int, mixed> $rows = [] ][, bool $useFirstRowAsHeader = true ]) : void
Parameters

array<string|int, mixed> $rows (optional)
Multidimensional array with row values.

bool $useFirstRowAsHeader (optional)
First row is used as header (true) or not (false).

Return values
void Displays the table to the Console output.
setHeader()

Set the header columns for the table.

public setHeader(array<string|int, mixed> $header) : void
Parameters

array<string|int, mixed> $header
Array with header columns.

Return values
void Set the header columns for the table.