public function Table::render in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Helper/Table.php \Symfony\Component\Console\Helper\Table::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 | +---------------+-----------------------+------------------+
File
- vendor/
symfony/ console/ Helper/ Table.php, line 205
Class
- Table
- Provides helpers to display a table.
Namespace
Symfony\Component\Console\HelperCode
public function render() {
$this
->calculateNumberOfColumns();
$this->rows = $this
->buildTableRows($this->rows);
$this->headers = $this
->buildTableRows($this->headers);
$this
->renderRowSeparator();
if (!empty($this->headers)) {
foreach ($this->headers as $header) {
$this
->renderRow($header, $this->style
->getCellHeaderFormat());
$this
->renderRowSeparator();
}
}
foreach ($this->rows as $row) {
if ($row instanceof TableSeparator) {
$this
->renderRowSeparator();
}
else {
$this
->renderRow($row, $this->style
->getCellRowFormat());
}
}
if (!empty($this->rows)) {
$this
->renderRowSeparator();
}
$this
->cleanup();
}