-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextNode.php
64 lines (55 loc) · 840 Bytes
/
TextNode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace wpscholar\Elements;
/**
* Class TextNode
*
* @property string $text
*/
class TextNode extends Node {
/**
* Text content
*
* @var string
*/
protected $_text = '';
/**
* Create a new text node instance
*
* @param string $text
*/
public function __construct( $text = '' ) {
$this->_text = $text;
}
/**
* Get node type
*
* @return string
*/
final public function get_type() {
return 'text';
}
/**
* Get text content
*
* @return string
*/
final public function get_text() {
return $this->_text;
}
/**
* Set text content
*
* @param string $text
*/
final protected function set_text( $text ) {
$this->_text = (string) $text;
}
/**
* Get text content on output
*
* @return string
*/
final public function __toString() {
return $this->_text;
}
}