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;
    }