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])
파일 보기 프로젝트 열기: webmozart/console 1 사용 예제들

공개 메소드들

메소드 설명
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.