public function getById($id, $fromRoot = true)
{
$root = $fromRoot === false ? $this : $this->getRoot();
if ($root->getId() === $id) {
return $root;
} else {
foreach ($root->children as $child) {
$tag = $child->getById($id, false);
if ($tag !== null) {
return $tag;
}
}
return null;
}
}