Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php
public function getAncestor($id)
    {
        if ( ! is_null($this->parent)) {
            if ($this->parent->id() == $id) {
                return $this->parent;
            }

            return $this->parent->getAncestor($id);
        }

        return null;
    }
public function getAncestor($id)
    {
        if ( ! is_null($this->parent)) {
            if ($this->parent->id() == $id) {
                return $this->parent;
            }

            return $this->parent->getAncestor($id);
        }

        return null;
    }
public function getAncestor ( $ id ) { if ( ! is_null ( $ this -> parent ) ) { if ( $ this -> parent -> id ( ) == $ id ) { return $ this -> parent ; } return $ this -> parent -> getAncestor ( $ id ) ; } return null ; }
Attempts to get an ancestor node by the given id.

@param int $id
@return null|AbstractNode
Attempts to get an ancestor node by the given id .