PHP Class Webmozart\Console\UI\Component\Grid

You can add data cells with {@link addCell()}. Optionally, you can set the minimum and maximum allowed number of columns with {@link setMinNbColumns()} and {@link setMaxNbColumns()}. If you want to style the grid, pass a {@link GridStyle} to the constructor.
Since: 1.0
Author: Bernhard Schussek ([email protected])
Inheritance: implements Webmozart\Console\UI\Component
Mostra file Open project: webmozart/console Class Usage Examples

Public Methods

Method Description
__construct ( GridStyle $style = null ) Creates a new grid.
addCell ( string $cell ) : static Adds a data cell to the grid.
addCells ( array $cells ) : static Adds data cells to the grid.
getMaxNbColumns ( ) : integer Returns the maximum number of columns in the grid.
getMinNbColumns ( ) : integer Returns the minimum number of columns in the grid.
render ( IO $io, integer $indentation ) Renders the grid.
setCells ( array $cells ) : static Sets the data cells in the grid.
setMaxNbColumns ( integer $maxNbColumns ) : static Sets the maximum number of columns in the grid.
setMinNbColumns ( integer $minNbColumns ) : static Sets the minimum number of columns in the grid.

Private Methods

Method Description
getCellWrapper ( Webmozart\Console\Api\Formatter\Formatter $formatter, $screenWidth, $excessColumnWidth, $indentation )
renderRows ( IO $io, array $rows, array $columnLengths, $excessColumnLength, $indentation )

Method Details

__construct() public method

Creates a new grid.
public __construct ( GridStyle $style = null )
$style Webmozart\Console\UI\Style\GridStyle The rendering style. By default, the grid is rendered with the style {@link GridStyle::borderless()}.

addCell() public method

Adds a data cell to the grid.
public addCell ( string $cell ) : static
$cell string The data cell.
return static The current instance.

addCells() public method

Adds data cells to the grid.
public addCells ( array $cells ) : static
$cells array The data cells.
return static The current instance.

getMaxNbColumns() public method

The default maximum is unlimited.
public getMaxNbColumns ( ) : integer
return integer The maximum number of columns.

getMinNbColumns() public method

The default minimum is 4.
public getMinNbColumns ( ) : integer
return integer The minimum number of columns.

render() public method

Renders the grid.
public render ( IO $io, integer $indentation )
$io Webmozart\Console\Api\IO\IO The I/O.
$indentation integer The number of spaces to indent.

setCells() public method

Sets the data cells in the grid.
public setCells ( array $cells ) : static
$cells array The data cells to set.
return static The current instance.

setMaxNbColumns() public method

The default maximum is unlimited.
public setMaxNbColumns ( integer $maxNbColumns ) : static
$maxNbColumns integer The maximum number of columns.
return static The current instance.

setMinNbColumns() public method

The default minimum is 4.
public setMinNbColumns ( integer $minNbColumns ) : static
$minNbColumns integer The minimum number of columns.
return static The current instance.