protected function groupRootsByScope($roots)
{
$rootsGroupedByScope = [];
foreach ($roots as $root) {
$key = $this->keyForScope($root);
if (!isset($rootsGroupedByScope[$key])) {
$rootsGroupedByScope[$key] = [];
}
$rootsGroupedByScope[$key][] = $root;
}
return $rootsGroupedByScope;
}