TextElement.php in Extensible BBCode 4.0.x
Same filename and directory in other branches
Namespace
Drupal\xbbcode\Parser\TreeFile
src/Parser/Tree/TextElement.phpView source
<?php
namespace Drupal\xbbcode\Parser\Tree;
/**
* An element representing a text fragment.
*/
class TextElement implements ElementInterface {
/**
* The text.
*
* @var string
*/
protected $text;
/**
* TextElement constructor.
*
* @param string $text
* The text.
*/
public function __construct(string $text) {
$this
->setText($text);
}
/**
* Get the text.
*
* @return string
* The text.
*/
public function getText() : string {
return $this->text;
}
/**
* Set the text.
*
* @param string $text
* The text.
*
* @return $this
*/
public function setText(string $text) : self {
$this->text = $text;
return $this;
}
/**
* {@inheritdoc}
*/
public function render() : string {
return $this
->getText();
}
}
Classes
Name | Description |
---|---|
TextElement | An element representing a text fragment. |