/**
  * @param AbstractBlock $block
  * @param CliRenderer   $renderer
  *
  * @return string
  */
 public function render(AbstractBlock $block, CliRenderer $renderer)
 {
     if (!$block instanceof Paragraph) {
         throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
     }
     return $renderer->renderInlines($block->children()) . "\n";
 }
 /**
  * @param AbstractInline $inline
  * @param CliRenderer    $renderer
  *
  * @return string
  */
 public function render(AbstractInline $inline, CliRenderer $renderer)
 {
     if (!$inline instanceof Emphasis) {
         throw new \InvalidArgumentException(sprintf('Incompatible inline type: "%s"', get_class($inline)));
     }
     return $renderer->style($renderer->renderInlines($inline->children()), 'italic');
 }
 /**
  * @param AbstractInline $inline
  * @param CliRenderer    $renderer
  *
  * @return string
  */
 public function render(AbstractInline $inline, CliRenderer $renderer)
 {
     if (!$inline instanceof Link) {
         throw new \InvalidArgumentException(sprintf('Incompatible inline type: "%s"', get_class($inline)));
     }
     return $renderer->style($renderer->renderInlines($inline->children()), ['underline', 'bold', 'light_blue']);
 }
 public function testRenderInlineBlocksThrowsExceptionIfNoRenderer()
 {
     $block = $this->getMock(AbstractInline::class);
     $this->setExpectedException(RuntimeException::class, sprintf('Unable to find corresponding renderer for inline type: "%s"', get_class($block)));
     $renderer = new CliRenderer([], [], new Color());
     $renderer->renderInlines([$block]);
 }
 /**
  * @param AbstractBlock $block
  * @param CliRenderer   $renderer
  *
  * @return string
  */
 public function render(AbstractBlock $block, CliRenderer $renderer)
 {
     if (!$block instanceof Heading) {
         throw new \InvalidArgumentException(sprintf('Incompatible block type: "%s"', get_class($block)));
     }
     $level = $block->getLevel();
     $text = $renderer->renderInlines($block->children());
     return sprintf("\n%s %s\n", $renderer->style(str_repeat('#', $level), 'dark_gray'), $renderer->style($text, ['bold', 'cyan']));
 }