getSortedModuleNames() публичный Метод

The names are sorted such that if a module m1 depends on a module m2, then m2 comes before m1 in the sorted set. If module names are passed, only those module names are sorted. Otherwise all module names are sorted.
public getSortedModuleNames ( array $namesToSort = [] ) : string[]
$namesToSort array The module names which should be sorted.
Результат string[] The sorted module names.
Пример #1
0
 private function getEnabledFilesystemPaths($repositoryPath)
 {
     // Get a copy so that we can remove the entries that we processed
     // already
     $inMappings = $this->mappings->toArray();
     $outMappings = array();
     $filesystemPaths = array();
     $this->filterEnabledMappings($repositoryPath, $inMappings, $outMappings);
     foreach ($outMappings as $mappingPath => $mappingsByModule) {
         foreach ($mappingsByModule as $moduleName => $mapping) {
             $filesystemPaths[$moduleName][$mappingPath] = $mapping->getFilesystemPaths();
         }
     }
     if (!$filesystemPaths) {
         return array();
     }
     // Sort primary keys (module names)
     $sortedNames = $this->overrideGraph->getSortedModuleNames(array_keys($filesystemPaths));
     $filesystemPaths = array_replace(array_flip($sortedNames), $filesystemPaths);
     // Sort secondary keys (repository paths)
     foreach ($filesystemPaths as $moduleName => $pathsByModule) {
         ksort($filesystemPaths[$moduleName]);
     }
     return $filesystemPaths;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     // Quit if no mappings exist
     if (!($moduleNames = $this->mappings->getModuleNames())) {
         return;
     }
     $sortedNames = $this->overrideGraph->getSortedModuleNames($moduleNames);
     try {
         foreach ($sortedNames as $moduleName) {
             foreach ($this->getEnabledMappingsByModuleName($moduleName) as $repositoryPath => $mapping) {
                 foreach ($mapping->getFilesystemPaths() as $filesystemPath) {
                     $this->repo->add($repositoryPath, $this->createResource($filesystemPath));
                     $this->added = true;
                 }
             }
         }
     } catch (Exception $e) {
         $this->repo->clear();
         throw $e;
     }
 }