forked from jbowens/jBBCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextNode.php
86 lines (73 loc) · 1.67 KB
/
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace JBBCode;
require_once('Node.php');
/**
* Jackson Owens
*
* Represents a piece of text data. TextNodes never have children.
*/
class TextNode extends Node {
/* The value of this text node */
protected $value;
/**
* Constructs a text node from its text string
*
* @param string $val
*/
public function __construct( $val ) {
$this->value = $val;
}
public function accept(NodeVisitor $visitor) {
$visitor->visitTextNode($this);
}
/**
* (non-PHPdoc)
* @see JBBCode.Node::isTextNode()
*
* returns true
*/
public function isTextNode() {
return true;
}
/**
* Returns the text string value of this text node.
*
* @return string
*/
public function getValue() {
return $this->value;
}
/**
* (non-PHPdoc)
* @see JBBCode.Node::getAsText()
*
* Returns the text representation of this node.
*
* @return this node represented as text
*/
public function getAsText() {
return $this->getValue();
}
/**
* (non-PHPdoc)
* @see JBBCode.Node::getAsBBCode()
*
* Returns the bbcode representation of this node. (Just its value)
*
* @return this node represented as bbcode
*/
public function getAsBBCode() {
return $this->getValue();
}
/**
* (non-PHPdoc)
* @see JBBCode.Node::getAsHTML()
*
* Returns the html representation of this node. (Just its value)
*
* @return this node represented as HTML
*/
public function getAsHTML() {
return $this->getValue();
}
}