gl-website-deployer/vendor/doctrine/rst-parser/lib/Renderers/DefaultNodeRenderer.php

34 lines
551 B
PHP
Raw Normal View History

2024-11-19 08:02:04 +01:00
<?php
declare(strict_types=1);
namespace Doctrine\RST\Renderers;
use Doctrine\RST\Nodes\Node;
final class DefaultNodeRenderer implements NodeRenderer
{
/** @var Node */
private $node;
public function __construct(Node $node)
{
$this->node = $node;
}
public function render(): string
{
$value = $this->node->getValue();
if ($value instanceof Node) {
return $value->render();
}
if ($value === null) {
return '';
}
return $value;
}
}