Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
71
vendor/doctrine/rst-parser/lib/Nodes/SpanNode.php
vendored
Normal file
71
vendor/doctrine/rst-parser/lib/Nodes/SpanNode.php
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\RST\Nodes;
|
||||
|
||||
use Doctrine\RST\Environment;
|
||||
use Doctrine\RST\Parser;
|
||||
use Doctrine\RST\Span\SpanProcessor;
|
||||
use Doctrine\RST\Span\SpanToken;
|
||||
|
||||
use function implode;
|
||||
use function is_array;
|
||||
|
||||
class SpanNode extends Node
|
||||
{
|
||||
/** @var string */
|
||||
protected $value;
|
||||
|
||||
/** @var string */
|
||||
private $text;
|
||||
|
||||
/** @var Environment */
|
||||
protected $environment;
|
||||
|
||||
/** @var SpanToken[] */
|
||||
private $tokens;
|
||||
|
||||
/** @param string|string[]|SpanNode $span */
|
||||
public function __construct(Parser $parser, $span)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->environment = $parser->getEnvironment();
|
||||
|
||||
if (is_array($span)) {
|
||||
$span = implode("\n", $span);
|
||||
}
|
||||
|
||||
if ($span instanceof SpanNode) {
|
||||
$span = $span->render();
|
||||
}
|
||||
|
||||
$spanProcessor = new SpanProcessor($this->environment, $span);
|
||||
|
||||
$this->value = $spanProcessor->process();
|
||||
$this->text = $spanProcessor->getText($this->value);
|
||||
$this->tokens = $spanProcessor->getTokens();
|
||||
}
|
||||
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/** @return SpanToken[] */
|
||||
public function getTokens(): array
|
||||
{
|
||||
return $this->tokens;
|
||||
}
|
||||
|
||||
public function getEnvironment(): Environment
|
||||
{
|
||||
return $this->environment;
|
||||
}
|
||||
|
||||
public function getText(): string
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue