PHP Class Webmozart\Console\UI\Component\LabeledParagraph

The paragraph is indented to the right of the label and wrapped into the dimensions of the output. You can align multiple labeled paragraphs by passing a {@link LabelAlignment} to {@link setAlignment()}.
Since: 1.0
Author: Bernhard Schussek ([email protected])
Inheritance: implements Webmozart\Console\UI\Component
Mostra file Open project: webmozart/console Class Usage Examples

Public Methods

Method Description
__construct ( string $label, string $text, integer $padding = 2, boolean $aligned = true ) Creates a new labeled paragraph.
getLabel ( ) : string Returns the label.
getPadding ( ) : integer Returns the padding between the label and the text in number of spaces.
getText ( ) : string Returns the text.
isAligned ( ) : boolean Returns whether the paragraph is aligned with other paragraphs in its alignment.
render ( IO $io, integer $indentation ) Renders the paragraph.
setAlignment ( LabelAlignment $alignment ) Sets the alignment used to align the paragraph.

Method Details

__construct() public method

Creates a new labeled paragraph.
public __construct ( string $label, string $text, integer $padding = 2, boolean $aligned = true )
$label string The label.
$text string The text.
$padding integer The padding between the text and label in number of spaces.
$aligned boolean Whether the paragraph should be aligned with the other paragraph in its alignment (if one is set).

getLabel() public method

Returns the label.
public getLabel ( ) : string
return string The label.

getPadding() public method

Returns the padding between the label and the text in number of spaces.
public getPadding ( ) : integer
return integer The number of spaces between the label and the text.

getText() public method

Returns the text.
public getText ( ) : string
return string The text.

isAligned() public method

Returns whether the paragraph is aligned with other paragraphs in its alignment.
public isAligned ( ) : boolean
return boolean Returns `true` if the paragraph should be aligned with the other paragraphs in the alignment and `false` otherwise.

render() public method

Renders the paragraph.
public render ( IO $io, integer $indentation )
$io Webmozart\Console\Api\IO\IO The I/O.
$indentation integer The number of spaces to indent.

setAlignment() public method

Sets the alignment used to align the paragraph.
public setAlignment ( LabelAlignment $alignment )
$alignment Webmozart\Console\UI\Alignment\LabelAlignment The alignment.