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

공개 메소드들

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