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 Grid

A grid of cells that are dynamically organized in the console window.

You can add data cells with Webmozart\Console\UI\Component\Grid::addCell(). Optionally, you can set the minimum and maximum allowed number of columns with Webmozart\Console\UI\Component\Grid::setMinNbColumns() and Webmozart\Console\UI\Component\Grid::setMaxNbColumns().

If you want to style the grid, pass a Webmozart\Console\UI\Style\GridStyle to the constructor.

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

Creates a new grid.

Creates a new grid.

Parameters

$style

The rendering style. By default, the grid is rendered with the style GridStyle::borderless().

public static
# addCell( string $cell )

Adds a data cell to the grid.

Adds a data cell to the grid.

Parameters

$cell
The data cell.

Returns

static
The current instance.
public static
# addCells( array $cells )

Adds data cells to the grid.

Adds data cells to the grid.

Parameters

$cells
The data cells.

Returns

static
The current instance.
public static
# setCells( array $cells )

Sets the data cells in the grid.

Sets the data cells in the grid.

Parameters

$cells
The data cells to set.

Returns

static
The current instance.
public integer
# getMinNbColumns( )

Returns the minimum number of columns in the grid.

Returns the minimum number of columns in the grid.

The default minimum is 4.

Returns

integer
The minimum number of columns.
public static
# setMinNbColumns( integer $minNbColumns )

Sets the minimum number of columns in the grid.

Sets the minimum number of columns in the grid.

The default minimum is 4.

Parameters

$minNbColumns
The minimum number of columns.

Returns

static
The current instance.
public integer
# getMaxNbColumns( )

Returns the maximum number of columns in the grid.

Returns the maximum number of columns in the grid.

The default maximum is unlimited.

Returns

integer
The maximum number of columns.
public static
# setMaxNbColumns( integer $maxNbColumns )

Sets the maximum number of columns in the grid.

Sets the maximum number of columns in the grid.

The default maximum is unlimited.

Parameters

$maxNbColumns
The maximum number of columns.

Returns

static
The current instance.
public
# render( Webmozart\Console\Api\IO\IO $io, integer $indentation = 0 )

Renders the grid.

Renders the grid.

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