You are here

public static function PHPUnit_Util_XML::nodeToText in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/XML.php \PHPUnit_Util_XML::nodeToText()

@since Method available since Release 3.4.0

Parameters

DOMNode $node:

Return value

string

File

vendor/phpunit/phpunit/src/Util/XML.php, line 158

Class

PHPUnit_Util_XML
XML helpers.

Code

public static function nodeToText(DOMNode $node) {
  if ($node->childNodes->length == 1) {
    return $node->textContent;
  }
  $result = '';
  foreach ($node->childNodes as $childNode) {
    $result .= $node->ownerDocument
      ->saveXML($childNode);
  }
  return $result;
}