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 (bschussek@gmail.com)
Inheritance: implements Webmozart\Console\UI\Component
Esempio n. 1
0
 /**
  * Adds a labeled paragraph to the alignment.
  *
  * @param LabeledParagraph $paragraph   The labeled paragraph.
  * @param int              $indentation The indentation of the paragraph.
  */
 public function add(LabeledParagraph $paragraph, $indentation = 0)
 {
     if ($paragraph->isAligned()) {
         $this->paragraphs[] = $paragraph;
         $this->indentations[] = $indentation;
     }
 }
Esempio n. 2
0
    public function testRenderWithLabelDistanceWrapsText()
    {
        $para = new LabeledParagraph('Label', self::LOREM_IPSUM, 6);
        $para->render($this->io);
        $expected = <<<'EOF'
Label      Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
           nonumy eirmod tempor invidunt

EOF;
        $this->assertSame($expected, $this->io->fetchOutput());
    }