PHPHtmlParser\Dom\TextNode::text PHP Method

text() public method

Returns the text of this node.
public text ( ) : string
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;
        }
    }

Usage Example

Example #1
0
 public function testText()
 {
     $node = new TextNode('foo bar');
     $this->assertEquals('foo bar', $node->text());
 }