PHP Класс Webmozart\Console\UI\Component\CellWrapper

You can add data cells with {@link addCell()}. Call {@link fit()} to fit the cells into a given maximum width and number of columns. You can access the rows with the wrapped cells with {@link getWrappedRows()}.
С версии: 1.0
Автор: Bernhard Schussek ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
addCell ( string $cell ) Adds a cell to the wrapper.
addCells ( array $cells ) Adds cells to the wrapper.
fit ( integer $maxTotalWidth, integer $nbColumns, Webmozart\Console\Api\Formatter\Formatter $formatter ) Fits the added cells into the given maximum total width with the given number of columns.
getCells ( ) : string[] Returns the data cells in the wrapper.
getColumnLengths ( ) : int[] Returns the lengths of the wrapped columns.
getEstimatedNbColumns ( integer $maxTotalWidth ) : integer Returns an estimated number of columns for the given maximum width.
getMaxTotalWidth ( ) : integer Returns the maximum allowed total width of the columns.
getNbColumns ( ) : integer Returns the number of wrapped columns.
getTotalWidth ( ) : integer Returns the actual total column width.
getWrappedRows ( ) : string[][] Returns the wrapped cells organized by rows and columns.
hasWordCuts ( ) : boolean Returns whether any of the cells contains words cut in two.
hasWordWraps ( ) : boolean Returns whether any of the cells needed to be wrapped into multiple lines.
setCells ( array $cells ) Sets the data cells in the wrapper.

Приватные методы

Метод Описание
initRows ( Webmozart\Console\Api\Formatter\Formatter $formatter )
refreshColumnLength ( $col )
resetState ( $maxTotalWidth, $nbColumns )
wrapColumn ( $col, $columnLength, Webmozart\Console\Api\Formatter\Formatter $formatter )
wrapColumns ( Webmozart\Console\Api\Formatter\Formatter $formatter )

Описание методов

addCell() публичный Метод

Adds a cell to the wrapper.
public addCell ( string $cell )
$cell string The data cell.

addCells() публичный Метод

Adds cells to the wrapper.
public addCells ( array $cells )
$cells array The data cells.

fit() публичный Метод

Fits the added cells into the given maximum total width with the given number of columns.
public fit ( integer $maxTotalWidth, integer $nbColumns, Webmozart\Console\Api\Formatter\Formatter $formatter )
$maxTotalWidth integer The maximum total width of the columns.
$nbColumns integer The number of columns to use.
$formatter Webmozart\Console\Api\Formatter\Formatter The formatter used to remove style tags.

getCells() публичный Метод

Returns the data cells in the wrapper.
public getCells ( ) : string[]
Результат string[] The data cells.

getColumnLengths() публичный Метод

The method {@link fit()} should be called before accessing this method. Otherwise, an empty array is returned.
public getColumnLengths ( ) : int[]
Результат int[] The lengths of each column.

getEstimatedNbColumns() публичный Метод

Returns an estimated number of columns for the given maximum width.
public getEstimatedNbColumns ( integer $maxTotalWidth ) : integer
$maxTotalWidth integer The maximum total width of the columns.
Результат integer The estimated number of columns.

getMaxTotalWidth() публичный Метод

The method {@link fit()} should be called before accessing this method. Otherwise this method returns zero.
public getMaxTotalWidth ( ) : integer
Результат integer The maximum allowed total width.

getNbColumns() публичный Метод

The method {@link fit()} should be called before accessing this method. Otherwise this method returns zero.
public getNbColumns ( ) : integer
Результат integer The number of columns.

getTotalWidth() публичный Метод

The method {@link fit()} should be called before accessing this method. Otherwise this method returns zero.
public getTotalWidth ( ) : integer
Результат integer The actual total column width.

getWrappedRows() публичный Метод

The method {@link fit()} should be called before accessing this method. Otherwise, an empty array is returned.
public getWrappedRows ( ) : string[][]
Результат string[][] An array of arrays. The first level represents rows, the second level the cells in each row.

hasWordCuts() публичный Метод

The method {@link fit()} should be called before accessing this method. Otherwise this method returns false.
public hasWordCuts ( ) : boolean
Результат boolean Returns `true` if a cell contains words cut in two and `false` otherwise.

hasWordWraps() публичный Метод

The method {@link fit()} should be called before accessing this method. Otherwise this method returns false.
public hasWordWraps ( ) : boolean
Результат boolean Returns `true` if a cell was wrapped into multiple lines and `false` otherwise.

setCells() публичный Метод

Sets the data cells in the wrapper.
public setCells ( array $cells )
$cells array The data cells.