1 | <?php |
||
9 | class TextNode extends LeafNode |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * This is a text node. |
||
14 | * |
||
15 | * @var Tag |
||
16 | */ |
||
17 | protected $tag; |
||
18 | |||
19 | /** |
||
20 | * This is the text in this node. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $text; |
||
25 | |||
26 | /** |
||
27 | * This is the converted version of the text. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $convertedText = null; |
||
32 | |||
33 | /** |
||
34 | * Sets the text for this node. |
||
35 | * |
||
36 | * @param string $text |
||
37 | */ |
||
38 | public function __construct($text, $removeDoubleSpace = true) |
||
52 | |||
53 | /** |
||
54 | * Returns the text of this node. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function text() |
||
76 | |||
77 | /** |
||
78 | * Sets the text for this node. |
||
79 | * |
||
80 | * @var string $text |
||
81 | * @return void |
||
82 | */ |
||
83 | public function setText($text) |
||
94 | |||
95 | /** |
||
96 | * This node has no html, just return the text. |
||
97 | * |
||
98 | * @return string |
||
99 | * @uses $this->text() |
||
100 | */ |
||
101 | public function innerHtml() |
||
105 | |||
106 | /** |
||
107 | * This node has no html, just return the text. |
||
108 | * |
||
109 | * @return string |
||
110 | * @uses $this->text() |
||
111 | */ |
||
112 | public function outerHtml() |
||
116 | |||
117 | /** |
||
118 | * Call this when something in the node tree has changed. Like a child has been added |
||
119 | * or a parent has been changed. |
||
120 | */ |
||
121 | protected function clear() |
||
125 | |||
126 | /** |
||
127 | * Checks if the current node is a text node. |
||
128 | * |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function isTextNode() |
||
135 | } |
||
136 |