/**
* Get the root of the tree
*
* @return ImmutableNodeInterface
*
* @since 4.0.0
*/
public function getRoot()
{
$root = $this->getParent();
if (!$root) {
return $this;
}
while ($root->hasParent()) {
$root = $root->getParent();
}
return $root;
}