protected function QueryPath::deepestNode in QueryPath 7.3
Same name and namespace in other branches
- 6 QueryPath/QueryPath.php \QueryPath::deepestNode()
- 7.2 QueryPath/QueryPath.php \QueryPath::deepestNode()
4 calls to QueryPath::deepestNode()
- QueryPath::deepest in QueryPath/
QueryPath.php - QueryPath::wrap in QueryPath/
QueryPath.php - QueryPath::wrapAll in QueryPath/
QueryPath.php - QueryPath::wrapInner in QueryPath/
QueryPath.php
File
- QueryPath/
QueryPath.php, line 869
Class
Code
protected function deepestNode(DOMNode $ele, $depth = 0, $current = NULL, &$deepest = NULL) {
if (!isset($current)) {
$current = array(
$ele,
);
}
if (!isset($deepest)) {
$deepest = $depth;
}
if ($ele
->hasChildNodes()) {
foreach ($ele->childNodes as $child) {
if ($child->nodeType === XML_ELEMENT_NODE) {
$current = $this
->deepestNode($child, $depth + 1, $current, $deepest);
}
}
}
elseif ($depth > $deepest) {
$current = array(
$ele,
);
$deepest = $depth;
}
elseif ($depth === $deepest) {
$current[] = $ele;
}
return $current;
}