text = $text;
$this->tag = new Tag('text');
parent::__construct();
}
/**
* Returns the text of this node.
*
* @return string
*/
public function text()
{
// convert charset
if ( ! is_null($this->encode)) {
if ( ! is_null($this->convertedText)) {
// we already know the converted value
return $this->convertedText;
}
$text = $this->encode->convert($this->text);
// remember the conversion
$this->convertedText = $text;
return $text;
} else {
return $this->text;
}
}
/**
* This node has no html, just return the text.
*
* @return string
* @uses $this->text()
*/
public function innerHtml()
{
return $this->text();
}
/**
* This node has no html, just return the text.
*
* @return string
* @uses $this->text()
*/
public function outerHtml()
{
return $this->text();
}
/**
* Call this when something in the node tree has changed. Like a child has been added
* or a parent has been changed.
*/
protected function clear()
{
$this->convertedText = null;
}
}