ApiGen\Parser\Elements\GroupSorter::sort PHP Метод

sort() публичный метод

public sort ( array $groups )
$groups array
    public function sort(array $groups)
    {
        if ($this->isNoneGroupOnly($groups)) {
            return [];
        }
        $this->groups = $groups;
        $groupNames = array_keys($groups);
        $this->lowercasedGroupNames = $this->convertGroupNamesToLower($groupNames);
        foreach ($groupNames as $groupName) {
            $this->addMissingParentGroups($groupName);
            $this->addMissingElementTypes($groupName);
        }
        uksort($this->groups, function ($one, $two) {
            return $this->compareGroups($one, $two, $this->configuration->getMain());
        });
        return $this->groups;
    }

Usage Example

 private function sortNamespacesAndPackages()
 {
     $areNamespacesEnabled = $this->configuration->areNamespacesEnabled($this->getNamespaceCount(), $this->getPackageCount());
     $arePackagesEnabled = $this->configuration->arePackagesEnabled($areNamespacesEnabled);
     if ($areNamespacesEnabled) {
         $this->namespaces = $this->groupSorter->sort($this->namespaces);
         $this->packages = [];
     } elseif ($arePackagesEnabled) {
         $this->namespaces = [];
         $this->packages = $this->groupSorter->sort($this->packages);
     } else {
         $this->namespaces = [];
         $this->packages = [];
     }
 }