PHPHtmlParser\Dom\InnerNode::isDescendant PHP Method

isDescendant() public method

Checks if the given node id is a descendant of the current node.
public isDescendant ( integer $id ) : boolean
$id integer
return boolean
    public function isDescendant($id)
    {
        if ($this->isChild($id)) {
            return true;
        }
        foreach ($this->children as $childId => $child) {
            /** @var InnerNode $node */
            $node = $child['node'];
            if ($node instanceof InnerNode && $node->hasChildren() && $node->isDescendant($id)) {
                return true;
            }
        }
        return false;
    }