Baum\SetValidator::groupRootsByScope PHP Метод

groupRootsByScope() защищенный Метод

Given a list of root nodes, it returns an array in which the keys are the array of the actual scope column values and the values are the root nodes inside that scope themselves.
protected groupRootsByScope ( mixed $roots ) : array
$roots mixed
Результат array
    protected function groupRootsByScope($roots)
    {
        $rootsGroupedByScope = [];
        foreach ($roots as $root) {
            $key = $this->keyForScope($root);
            if (!isset($rootsGroupedByScope[$key])) {
                $rootsGroupedByScope[$key] = [];
            }
            $rootsGroupedByScope[$key][] = $root;
        }
        return $rootsGroupedByScope;
    }