phpQueryObject::text PHP Method

text() public method

Return joined text content.
public text ( $text = null, $callback1 = null, $callback2 = null, $callback3 = null ) : string
return string
    public function text($text = null, $callback1 = null, $callback2 = null, $callback3 = null)
    {
        if (isset($text)) {
            return $this->html(htmlspecialchars($text));
        }
        $args = func_get_args();
        $args = array_slice($args, 1);
        $return = '';
        foreach ($this->elements as $node) {
            $text = $node->textContent;
            if (count($this->elements) > 1 && $text) {
                $text .= "\n";
            }
            foreach ($args as $callback) {
                $text = phpQuery::callbackRun($callback, array($text));
            }
            $return .= $text;
        }
        return $return;
    }