protected static function PHPUnit_Util_XML::getDescendants in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Util/XML.php \PHPUnit_Util_XML::getDescendants()
Recursively get flat array of all descendants of this node.
@since Method available since Release 3.3.0
Parameters
DOMNode $node:
Return value
array
1 call to PHPUnit_Util_XML::getDescendants()
- PHPUnit_Util_XML::findNodes in vendor/
phpunit/ phpunit/ src/ Util/ XML.php - Parse out the options from the tag using DOM object tree.
File
- vendor/
phpunit/ phpunit/ src/ Util/ XML.php, line 843
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();
}