The paragraph is wrapped into the dimensions of the output.
Since: 1.0
Author: Bernhard Schussek (bschussek@gmail.com)
Inheritance: implements Webmozart\Console\UI\Component
Esempio n. 1
0
 /**
  * Renders the name and version.
  *
  * @param IO  $io          The I/O.
  * @param int $indentation The number of spaces to indent.
  */
 public function render(IO $io, $indentation = 0)
 {
     if ($this->config->getDisplayName() && $this->config->getVersion()) {
         $paragraph = new Paragraph("{$this->config->getDisplayName()} version <c1>{$this->config->getVersion()}</c1>");
     } elseif ($this->config->getDisplayName()) {
         $paragraph = new Paragraph("{$this->config->getDisplayName()}");
     } else {
         $paragraph = new Paragraph('Console Tool');
     }
     $paragraph->render($io, $indentation);
 }
Esempio n. 2
0
    public function testSkipIndentationForEmptyLines()
    {
        $para = new Paragraph(self::LOREM_IPSUM . "\n\n" . self::LOREM_IPSUM);
        $para->render($this->io, 6);
        $expected = <<<'EOF'
      Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
      eirmod tempor invidunt

      Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
      eirmod tempor invidunt

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