XmlImportAstElseif.php
1 month ago
XmlImportAstExpression.php
1 month ago
XmlImportAstFloat.php
1 month ago
XmlImportAstForeach.php
1 month ago
XmlImportAstFunction.php
1 month ago
XmlImportAstIf.php
1 month ago
XmlImportAstInteger.php
1 month ago
XmlImportAstLiteral.php
1 month ago
XmlImportAstMath.php
1 month ago
XmlImportAstPrint.php
1 month ago
XmlImportAstSequence.php
1 month ago
XmlImportAstSpintax.php
1 month ago
XmlImportAstStatement.php
1 month ago
XmlImportAstString.php
1 month ago
XmlImportAstText.php
1 month ago
XmlImportAstWith.php
1 month ago
XmlImportAstXPath.php
1 month ago
XmlImportAstXpathClause.php
1 month ago
XmlImportAstText.php
61 lines
| 1 | <?php |
| 2 | // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals |
| 3 | /** |
| 4 | * @author Olexandr Zanichkovsky <olexandr.zanichkovsky@zophiatech.com> |
| 5 | * @package AST |
| 6 | */ |
| 7 | |
| 8 | require_once dirname(__FILE__) . '/XmlImportAstStatement.php'; |
| 9 | |
| 10 | /** |
| 11 | * Represents a text |
| 12 | */ |
| 13 | class XmlImportAstText extends XmlImportAstStatement |
| 14 | { |
| 15 | /** |
| 16 | * Value of a text node |
| 17 | * |
| 18 | * @var string |
| 19 | */ |
| 20 | private $value; |
| 21 | |
| 22 | /** |
| 23 | * Creates new instance |
| 24 | * |
| 25 | * @param string $value |
| 26 | */ |
| 27 | public function __construct($value) |
| 28 | { |
| 29 | $this->value = $value; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Gets value of a text node |
| 34 | * |
| 35 | * @return string |
| 36 | */ |
| 37 | public function getValue() |
| 38 | { |
| 39 | return $this->value; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * String representation of the node |
| 44 | * |
| 45 | * @return string |
| 46 | */ |
| 47 | public function __toString() |
| 48 | { |
| 49 | $result = "--> begin " . get_class($this) . "\n"; |
| 50 | $array = explode("\n", trim($this->getValue())); |
| 51 | for ($i = 0; $i < count($array); $i++) |
| 52 | { |
| 53 | $array[$i] = ' ' . $array[$i]; |
| 54 | } |
| 55 | $result .= implode("\n", $array) . "\n"; |
| 56 | $result .= "--> end " . get_class($this); |
| 57 | |
| 58 | return $result; |
| 59 | } |
| 60 | } |
| 61 |