PHP Класс Webmozart\Console\UI\Alignment\LabelAlignment

The alignment takes {@link LabeledParagraph} instances and aligns the texts next to the labels so that all texts start at the same offset. Pass the paragraphs that you want to align to {@link add()}. When you call {@link align()}, the text offset is calculated. You can retrieve the calculated offset with {@link getTextOffset()}.
С версии: 1.0
Автор: Bernhard Schussek ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
add ( LabeledParagraph $paragraph, integer $indentation ) Adds a labeled paragraph to the alignment.
align ( Webmozart\Console\Api\Formatter\Formatter $formatter, integer $indentation ) Calculates the text offset based on all labels in the alignment.
getTextOffset ( ) : integer Returns the calculated text offset.
setTextOffset ( integer $textOffset ) Manually sets the text offset.

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

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

Adds a labeled paragraph to the alignment.
public add ( LabeledParagraph $paragraph, integer $indentation )
$paragraph Webmozart\Console\UI\Component\LabeledParagraph The labeled paragraph.
$indentation integer The indentation of the paragraph.

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

The passed indentation is added to the indentations of all labeled paragraphs.
public align ( Webmozart\Console\Api\Formatter\Formatter $formatter, integer $indentation )
$formatter Webmozart\Console\Api\Formatter\Formatter The formatter used to remove style tags when calculating the label width.
$indentation integer The indentation.

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

Before calling {@link align()} or {@link setTextOffset()}, this method returns 0.
public getTextOffset ( ) : integer
Результат integer The text offset.

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

Manually sets the text offset.
public setTextOffset ( integer $textOffset )
$textOffset integer The text offset.