public function text($text = NULL) { if (isset($text)) { $callback = Constraints::isCallable($text, FALSE, TRUE); foreach ($this->_nodes as $index => $node) { if ($callback) { $node->nodeValue = $callback($node, $index, $node->nodeValue); } else { $node->nodeValue = $text; } } return $this; } else { $result = ''; foreach ($this->_nodes as $node) { $result .= $node->textContent; } return $result; } }