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
Afficher le fichier Open project: webmozart/console Class Usage Examples

Méthodes publiques

Méthode 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

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

Method Details

__construct() public méthode

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 méthode

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

addCells() public méthode

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

getMaxNbColumns() public méthode

The default maximum is unlimited.
public getMaxNbColumns ( ) : integer
Résultat integer The maximum number of columns.

getMinNbColumns() public méthode

The default minimum is 4.
public getMinNbColumns ( ) : integer
Résultat integer The minimum number of columns.

render() public méthode

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 méthode

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

setMaxNbColumns() public méthode

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

setMinNbColumns() public méthode

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