protected function isEachRootValid($roots)
{
$left = $right = 0;
foreach ($roots as $root) {
$rootLeft = $root->getLeft();
$rootRight = $root->getRight();
if (!($rootLeft > $left && $rootRight > $right)) {
return false;
}
$left = $rootLeft;
$right = $rootRight;
}
return true;
}