public function getFirstAncestor($class_name)
    {
        if (!class_exists($class_name)) {
            return null;
        }

        if ($this->parent === null) {
            $out = null;
        } elseif ($this->parent instanceof $class_name) {
            $out = $this->parent;
        } else {
            $out = $this->parent->getFirstAncestor($class_name);
        }

        return $out;
    }