PHP Class Platformsh\Cli\Console\AdaptiveTable

Inheritance: extends Symfony\Component\Console\Helper\Table
显示文件 Open project: commerceguys/platform-cli Class Usage Examples

Protected Properties

Property Type Description
$headersCopy
$maxTableWidth integer
$minColumnWidth integer
$outputCopy
$rowsCopy parent Table class.

Public Methods

Method Description
__construct ( Symfony\Component\Console\Output\OutputInterface $output, integer | null $maxTableWidth = null, integer | null $minColumnWidth = 10 ) AdaptiveTable constructor.
addRow ( $row )
render ( )
setHeaders ( array $headers )

Protected Methods

Method Description
adaptCells ( array $rows, array $maxColumnWidths ) : array Modify table rows, wrapping their cells' content to the max column width.
adaptRows ( ) Adapt rows based on the terminal width.
getMaxColumnWidths ( ) : array
getMaxContentWidth ( integer $columnCount ) : integer Find the maximum content width (excluding decoration) for each table row.
getTerminalWidth ( integer $default = 120 ) : integer
wrapCell ( string $contents, integer $width ) : string Word-wrap the contents of a cell, so that they fit inside a max width.

Private Methods

Method Description
getCellWidth ( string | Symfony\Component\Console\Helper\TableCell $cell ) : float | integer Get the default width of a table cell (the length of its longest line).

Method Details

__construct() public method

AdaptiveTable constructor.
public __construct ( Symfony\Component\Console\Output\OutputInterface $output, integer | null $maxTableWidth = null, integer | null $minColumnWidth = 10 )
$output Symfony\Component\Console\Output\OutputInterface
$maxTableWidth integer | null
$minColumnWidth integer | null

adaptCells() protected method

Modify table rows, wrapping their cells' content to the max column width.
protected adaptCells ( array $rows, array $maxColumnWidths ) : array
$rows array
$maxColumnWidths array
return array

adaptRows() protected method

Adapt rows based on the terminal width.
protected adaptRows ( )

addRow() public method

Overrides Table->addRow() so the row content can be accessed.
public addRow ( $row )

getMaxColumnWidths() protected method

protected getMaxColumnWidths ( ) : array
return array An array of the maximum column widths that fit into the table width, keyed by the column number.

getMaxContentWidth() protected method

Find the maximum content width (excluding decoration) for each table row.
protected getMaxContentWidth ( integer $columnCount ) : integer
$columnCount integer The number of columns in the table.
return integer The maximum table width, minus the width taken up by decoration.

getTerminalWidth() protected method

protected getTerminalWidth ( integer $default = 120 ) : integer
$default integer
return integer

render() public method

Overrides Table->render(), to adapt all the cells to the table width.
public render ( )

setHeaders() public method

Overrides Table->setHeaders() so the header content can be accessed.
public setHeaders ( array $headers )
$headers array

wrapCell() protected method

Word-wrap the contents of a cell, so that they fit inside a max width.
protected wrapCell ( string $contents, integer $width ) : string
$contents string
$width integer
return string

Property Details

$headersCopy protected_oe property

protected $headersCopy

$maxTableWidth protected_oe property

protected int $maxTableWidth
return integer

$minColumnWidth protected_oe property

protected int $minColumnWidth
return integer

$outputCopy protected_oe property

protected $outputCopy

$rowsCopy protected_oe property

parent Table class.
protected $rowsCopy