Overview

Namespaces

  • Webmozart
    • Console
      • Adapter
      • Api
        • Application
        • Args
          • Format
        • Command
        • Config
        • Event
        • Formatter
        • IO
        • Resolver
      • Args
      • Config
      • Formatter
      • Handler
        • Help
      • IO
        • InputStream
        • OutputStream
      • Process
      • Resolver
      • UI
        • Alignment
        • Component
        • Help
        • Layout
        • Style
      • Util

Classes

  • BorderUtil
  • CellWrapper
  • EmptyLine
  • ExceptionTrace
  • Grid
  • LabeledParagraph
  • NameVersion
  • Paragraph
  • Table
  • Overview
  • Namespace
  • Class

Class Table

A table of rows and columns.

You can add rows to the table with Webmozart\Console\UI\Component\Table::addRow(). You may optionally set a header row with Webmozart\Console\UI\Component\Table::setHeaderRow().

If you want to style the table, pass a Webmozart\Console\UI\Style\TableStyle instance to the constructor.

Webmozart\Console\UI\Component\Table implements Webmozart\Console\UI\Component
Namespace: Webmozart\Console\UI\Component
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at UI/Component/Table.php
Methods summary
public
# __construct( Webmozart\Console\UI\Style\TableStyle $style = null )

Creates a new table.

Creates a new table.

Parameters

$style

The rendering style. By default, the table is rendered with the style TableStyle::asciiBorder().

public static
# setHeaderRow( array $row )

Sets the header cells of the table.

Sets the header cells of the table.

Parameters

$row
The header cells.

Returns

static
The current instance.

Throws

LogicException

If the row contains more or less columns than rows previously added to the table.

public static
# addRow( array $row )

Adds a row to the table.

Adds a row to the table.

Parameters

$row
An array of data cells.

Returns

static
The current instance.

Throws

LogicException

If the row contains more or less columns than rows previously added to the table.

public static
# addRows( array $rows )

Adds rows to the table.

Adds rows to the table.

Parameters

$rows
The rows to add.

Returns

static
The current instance.

Throws

LogicException

If a row contains more or less columns than rows previously added to the table.

public static
# setRows( array $rows )

Sets the rows in the table.

Sets the rows in the table.

Parameters

$rows
The rows to set.

Returns

static
The current instance.

Throws

LogicException

If a row contains more or less columns than rows previously added to the table.

public static
# setRow( integer $index, array $row )

Sets a specific row in the table.

Sets a specific row in the table.

Parameters

$index
The row index.
$row
An array of data cells.

Returns

static
The current instance.

Throws

LogicException

If the row contains more or less columns than rows previously added to the table.

public
# render( Webmozart\Console\Api\IO\IO $io, integer $indentation = 0 )

Renders the table.

Renders the table.

Parameters

$io
The I/O.
$indentation
The number of spaces to indent.

Implementation of

Webmozart\Console\UI\Component::render()
Webmozart Console API API documentation generated by ApiGen