Returns a list of modules, sorted by dependencies.

@return Module[]

@throws CircularModuleLoadOrderDetectedException
976089
public function getSortedModuleList() : array {
		$moduleList = $this->modules;

		foreach ($moduleList as $moduleSpec) {
			$moduleClass = $moduleSpec['class'];
			$module      = $moduleSpec['object'];

			if ($module instanceof OrderAwareModule) {
				//All modules that should be loaded after this one
				foreach ($module->getModulesAfter() as $afterModuleClass) {
					if (\array_key_exists($afterModuleClass, $moduleList)) {
						$moduleList[$moduleClass]['after'][] = $afterModuleClass;
						$moduleList[$afterModuleClass]['before'][] = $moduleClass;
					}
				}
				//All modules that should be loaded before this one
				foreach ($module->getModulesBefore() as $afterModuleClass) {
					if (\array_key_exists($afterModuleClass, $moduleList)) {
						$moduleList[$moduleClass]['before'][] = $afterModuleClass;
						$moduleList[$afterModuleClass]['after'][] = $moduleClass;
					}
				}
			}
		}

		$sortedList = [];
		$noIncomingNodes = [];
		foreach ($moduleList as $moduleSpec) {
			$moduleSpec['after']  = \array_unique($moduleSpec['after']);
			$moduleSpec['before'] = \array_unique($moduleSpec['before']);
			if (empty($moduleSpec['before'])) {
				$noIncomingNodes[$moduleSpec['class']] = $moduleSpec;
			}
		}

		//Do the topological sorting (Kahn's algorithm)
		while (!empty($noIncomingNodes)) {
			$moduleSpec = array_shift($noIncomingNodes);
			\array_push($sortedList, $moduleSpec);
			unset($moduleList[$moduleSpec['class']]);

			foreach ($moduleSpec['after'] as $nextModuleKey => $nextModuleClass) {
				unset($moduleList[$nextModuleClass]['before'][
					\array_search($moduleSpec['class'], $moduleList[$nextModuleClass]['before'])
				]);
				if (empty($moduleList[$nextModuleClass]['before'])) {
					$noIncomingNodes[] = $moduleList[$nextModuleClass];
				}
				unset($moduleSpec['after'][$nextModuleKey]);
			}
		}

		foreach ($moduleList as $key => $remainingModuleSpec) {
			if (empty($remainingModuleSpec['before'])) {
				$sortedList[] = $moduleList[$remainingModuleSpec['class']];
				unset($moduleList[$key]);
			}
		}

		if (!empty($moduleList)) {
			throw new CircularModuleLoadOrderDetectedException($this->getDotGraph());
		} else {
			$result = [];
			foreach ($sortedList as $moduleSpec) {
				$result[] = $moduleSpec['object'];
			}
			return $result;
		}
	}
153256
public function getApplicationModules()
    {
        $modules = [];

        foreach ($this->getModules() as $id => $obj) {
            if ($obj instanceof Module) {
                $modules[$id] = $obj;
            }
        }

        return $modules;
    }
319320
public function getAllModules()
    {
        $modules = array_map(function ($value) {
            return $this->loadModule($value);
        }, $this->registry->getMap());

        return array_filter($modules, function ($module) {
            return !is_null($module);
        });
    }
413151
public function getInstallers()
    {
        $this->orderedInstallers = [];

        if ($this->orderInstallersByNumber) {
            $this->orderInstallersByNumber();
        }

        if ($this->orderInstallersByDependencies) {
            $this->orderInstallersByDependencies();
        }

        if (!$this->orderInstallersByNumber && !$this->orderInstallersByDependencies) {
            $this->orderedInstallers = $this->installers;
        }

        return $this->orderedInstallers;
    }
1336747
public final Iterator<String> loadedModuleRoles() {
        String [] names = m_moduleContext.getBeanNamesForType(Module.class,false,true);
        return Arrays.asList(names).iterator();
    }
86691
@Override
    public List<Module> getModules() {
        modules = Lists.createWhenNull(modules);
        if (ModuleUtils.getModule(modules, DCModule.URI) == null) {
            modules.add(new DCModuleImpl());
        }
        return modules;
    }
409504
public static function getModules()
    {
        return \Cache::remember('modules', 604800, function ()
        {
            $diskModules = Module::getModulesFromDisk();
            if ($diskModules)
                return self::checkModulesInDb($diskModules);
            else
                return [];
        });
    }
589405
public List<ModuleRef> getModules() {
        if (closed.get()) {
            throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
        }
        final List<ModuleRef> moduleRefs = new ArrayList<>();
        for (final ClasspathElement classpathElement : classpathOrder) {
            if (classpathElement instanceof ClasspathElementModule) {
                moduleRefs.add(((ClasspathElementModule) classpathElement).getModuleRef());
            }
        }
        return moduleRefs;
    }
539395
public function getCurrentModuleDependencies($recursive = false)
    {
        if (empty($this->moduleDescriptor->required)) {
            return [];
        }

        $dependencies = [];
        foreach ($this->moduleDescriptor->required->module as $dependency) {
            $dependencyArray = [
                "code" => (string)$dependency,
                "version" => (string)$dependency['version'],
            ];
            if (!\in_array($dependencyArray, $dependencies)) {
                $dependencies[] = $dependencyArray;
            }

            if ($recursive) {
                $recursiveModuleValidator = new ModuleValidator(THELIA_MODULE_DIR . '/' . (string)$dependency);
                array_merge(
                    $dependencies,
                    $recursiveModuleValidator->getCurrentModuleDependencies(true)
                );
            }
        }

        return $dependencies;
    }
904973
protected function getModulesCommands()
    {
        $commands = [];

        foreach (ModuleManager::getInstalledModules() as $module) {
            $cliFile = getLocalPath('modules/' . $module['ID'] . '/cli.php');

            if ($cliFile === false) {
                continue;
            } elseif (!Loader::includeModule($module['ID'])) {
                continue;
            }

            $config = include_once $this->getDocumentRoot() . $cliFile;

            if (isset($config['commands']) && is_array($config['commands'])) {
                $commands = array_merge($commands, $config['commands']);
            }
        }

        return $commands;
    }
110849
public function getModules(){
        if($this->loadModules != 'ALL'){
            $this->connection->select('name');
            $this->connection->from($this->tableModule);
            $modules= $this->connection->get()->fetchAll(\PDO::FETCH_ASSOC);
            foreach ($modules as $module) {
                $this->getModule($module['name']);
            }
            $this->loadModules= 'ALL';
        }
        return $this->modules;
    }
66618
public function getDesignModules()
    {
        $iterator = $this->createFinder()
            ->in($this->getAbsoluteDesignFolder())
            ->directories();

        $modules = [];
        foreach ($iterator as $file) {
        	if(file_exists($file->getRealPath().'/index.ss')) {
            	$modules[] = new DesignModule($file->getRealPath());
        	}
        }

        return $modules;
    }
1036036
protected function getDependencies()
    {
        return [
            'factories' => [
                PermissionMiddleware::class => PermissionMiddlewareFactory::class,
                ExpressiveRouteName::class => InvokableFactory::class,
                PermissionMiddleware::class => PermissionMiddlewareFactory::class,
                ResourceResolver::class => ResourceResolverAbstractFactory::class,
                RoleResolver::class => RoleResolverFactory::class,
                AclMiddleware::class => AclMiddlewareFactory::class,
                Acl::class => AclFromDataStoreFactory::class,
                UserRepository::class => UserRepositoryFactory::class,
                GuestAuthentication::class => GuestAuthenticationFactory::class,
                RedirectMiddleware::class => RedirectMiddlewareFactory::class,
                GoogleClient::class => GoogleClientFactory::class,
            ],
            'aliases' => [
                ConfigProvider::AUTHENTICATION_MIDDLEWARE_SERVICE => AuthenticationMiddleware::class,
                AuthenticationInterface::class => 'authenticationServiceChain',
                UserRepositoryInterface::class => UserRepository::class,

                self::RULE_DATASTORE_SERVICE => AclRulesTable::class,
                self::ROLE_DATASTORE_SERVICE => AclRolesTable::class,
                self::RESOURCE_DATASTORE_SERVICE => AclResourceTable::class,
                self::PRIVILEGE_DATASTORE_SERVICE => AclPrivilegeTable::class,
                self::USER_DATASTORE_SERVICE => AclUsersTable::class,
                self::USER_ROLE_DATASTORE_SERVICE => AclUserRolesTable::class,
            ],
            'abstract_factories' => [
                ResourceResolverAbstractFactory::class,
                RouteAttributeAbstractFactory::class,
                RouteNameAbstractFactory::class,
                MiddlewarePipeAbstractFactory::class,
                AuthenticationChainAbstractFactory::class,
                BasicAccessAbstractFactory::class,
                PhpSessionAbstractFactory::class,
                CredentialMiddlewareAbstractFactory::class,
            ],
            'invokables' => [
                PrivilegeResolver::class => PrivilegeResolver::class,
                AccessForbiddenHandler::class => AccessForbiddenHandler::class,
                ExpressiveRouteName::class => ExpressiveRouteName::class,
            ],
        ];
    }
827663
public function listModules()
    {
        $uri = 'asterisk/modules';

        $response = $this->client->getEndpoint()->get($uri);

        $modules = [];
        foreach (\GuzzleHttp\json_decode($response->getBody()) as $module) {
            $modules[] = new Module($module);
        }

        return $modules;
    }
14038
public function getModules(){
		$modules=array();
		$db=BFactory::getDBO();
		if(empty($db)){
			return $modules; //False?
			}
		$qr='SELECT * from `soft_modules_rules` where pageid='.$this->id;
		$q=$db->Query($qr);
		if(empty($q)){
			return $modules; //False?
			}
		while($l=$db->fetch($q)){
			$id=(int)$l['id'];
			$modules[$id]=new BSoftModule();
			$modules[$id]->group=$this;
			$modules[$id]->load($l);
			}
		return $modules;
		}
999057
public function sort()
    {
        $deps = $this->all();
        $sorted = $this->sortDeps($deps);

        return $this->dependency->getSorted($sorted);
    }
1303651
public function getDependencies()
    {
        // Simple cache.
        if (is_array($this->dependencies)) {
            return $this->dependencies;
        }
        $this->dependencies = [];

        $filter = new StatementFilter();
        $parser = new CodeParser();

        $statements = $parser->parseFile($this->directory.'/version.php');

        try {
            $assign = $filter->findFirstPropertyFetchAssignment($statements, 'plugin', 'dependencies');
        } catch (\Exception $e) {
            try {
                $assign = $filter->findFirstPropertyFetchAssignment($statements, 'module', 'dependencies');
            } catch (\Exception $e) {
                return $this->dependencies;
            }
        }

        if (!$assign->expr instanceof Array_) {
            throw new \RuntimeException('The $plugin->dependencies must be assigned to an array in the version.php file.');
        }
        $this->dependencies = $filter->arrayStringKeys($assign->expr);

        return $this->dependencies;
    }