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