public function get_root() { $root = $this; while ($root->parent !== null) { $root = $root->parent; } return $root; }