protected static function PHPUnit_Util_XML::getDescendants

Recursively get flat array of all descendants of this node.

@since Method available since Release 3.3.0 @author Mike Naberezny <mike@maintainable.com> @author Derek DeVries <derek@maintainable.com>

Parameters

DOMNode $node:

Return value

array

1 call to PHPUnit_Util_XML::getDescendants()
PHPUnit_Util_XML::findNodes in drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/XML.php
Parse out the options from the tag using DOM object tree.

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/XML.php, line 855

Class

PHPUnit_Util_XML
XML helpers.

Code

protected static function getDescendants(DOMNode $node) {
  $allChildren = array();
  $childNodes = $node->childNodes ? $node->childNodes : array();
  foreach ($childNodes as $child) {
    if ($child->nodeType === XML_CDATA_SECTION_NODE || $child->nodeType === XML_TEXT_NODE) {
      continue;
    }
    $children = self::getDescendants($child);
    $allChildren = array_merge($allChildren, $children, array(
      $child,
    ));
  }
  return isset($allChildren) ? $allChildren : array();
}