Load all modules in the Modules directory
@return void
@ignore
513652
protected function _loadModules() 
		{

			// Check module directories
			$dh = opendir(MODULE_PATH);
			while (false !== ($filename = readdir($dh))) {

				// Directory?
				if (is_dir(MODULE_PATH . "/" . $filename) && !preg_match('/^\./', $filename)) {

					// Load the module
					Module::load($filename);

				}

			}

		}
589736
private function load()
    {
        if (! $this->loaded) {
            $this->databoxes = $this->repository->findAll();
            $this->loaded = true;
        }
    }
1229716
public function includeModules()
    {
        if (!is_array($this->needModules) || empty($this->needModules))
        {
            return false;
        }

        foreach ($this->needModules as $module)
        {
            if (!Main\Loader::includeModule($module))
            {
                throw new Main\LoaderException('Failed include module "'.$module.'"');
            }
        }
    }
580598
protected function runAllAppModules()
    {
        $tree = $this->moduleList->getLoadTree();

        foreach ($tree as $firstLine) {
            foreach ($firstLine as $secondLine) {
                foreach ($secondLine as $moduleName) {
                    $this->runModule($moduleName);
                }
            }
        }
    }
1269478
protected static function _loadModulesConfig( )
		{
			$config = array( '..' , '.' );
			foreach ( static::options( ) as $key => $val )
			{
				$config[ ] = $key . '.php';
			}
			foreach ( Module::all( ) as $k => $module )
			{
				$scanned_directory = array_diff( scandir( ptc_path( 'root' ) . '/modules/' . $k . '/config' ) , $config );
				if ( !empty( $scanned_directory ) )
				{
					foreach ( $scanned_directory as $file )
					{
						$option_name = str_replace( '.php' , '' , $file );
						$options = require( ptc_path( 'root' ) . '/modules/' . $k . '/config/' . $file );
						if ( ptc_array_get( $options , '_load' ) )
						{
							$options = call_user_func( ptc_array_get( $options , '_load' ) , $options );
						}
						static::option( $option_name , $options );
					}
				}
			}
		}
1197
private function addModuleRules()
	{
		// Load the routes from cache
		$moduleRoutes = array();
		$directories = glob(Yii::getPathOfAlias('application.modules') . '/*' , GLOB_ONLYDIR);

		foreach ($directories as $dir)
		{
			$routePath = $dir .DS. 'config' .DS. 'routes.php';
			if (file_exists($routePath))
			{
				$routes = require_once($routePath);
				// Unit tests are failing here for some reason
				if (!is_array($routes))
					continue;

				foreach ($routes as $k=>$v)
				$moduleRoutes[$k] = $v;
			}
		}

		return $moduleRoutes;
	}
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;
    }
608435
public function loadConfig()
    {
        $fileName = File::path(dirname($this->getPath()), 'config/config.php');
        if(is_file($fileName))
        {
            Config::addConfig('@' . $this->moduleName, include $fileName);
        }
    }
831903
public function initialize()
    {
        $modules = $this->loader->getModules();

        if (empty($modules)) {
            throw new RuntimeException('No modules found. Initialization halted');
        } else {
            $this->loadAll($modules);
            $this->modules = $modules;

            // Validate on demand
            $this->validateCoreModuleNames();
        }
    }
631497
protected function loadDetectedDirectoriesAndFiles()
    {
        if ($this->directoriesAndFiles === null) {
            $this->directoriesAndFiles = json_decode($this->cache->get($this->identifier . '_directoriesAndFiles'), true);
            if (!is_array($this->directoriesAndFiles)) {
                $this->directoriesAndFiles = [];
            }
        }
    }
944419
public static function autoload(): void
    {
        //  CI base helpers
        require_once BASEPATH . 'core/Common.php';

        $aComponents = [];
        foreach (Components::available() as $oModule) {
            $aComponents[] = (object) [
                'slug'     => $oModule->slug,
                'autoload' => $oModule->autoload,
            ];
        }

        //  Module items
        foreach ($aComponents as $oModule) {
            //  Helpers
            if (!empty($oModule->autoload->helpers)) {
                foreach ($oModule->autoload->helpers as $sHelper) {
                    if (is_array($sHelper)) {
                        list($sName, $sProvider) = $sHelper;
                        self::helper($sName, $sProvider);
                    } else {
                        self::helper($sHelper, $oModule->slug);
                    }
                }
            }
            //  Services
            if (!empty($oModule->autoload->services)) {
                foreach ($oModule->autoload->services as $sService) {
                    if (is_array($sHelper)) {
                        list($sName, $sProvider) = $sService;
                        self::service($sName, $sProvider);
                    } else {
                        self::service($sService, $oModule->slug);
                    }
                }
            }
        }
    }
267249
private function load()
    {
        if ($this->config === null) {
            $this->config = [];
            $localPath = '/conf/dependencies.php';
            $appRoot = $this->env->getBootstrap()->getAppRoot();
            $fs = $this->env->getFileSystem();
            if ($fs->fileExists($appRoot . $localPath)) {
                /** @noinspection PhpIncludeInspection */
                $this->config = require_once($fs->getRealPath($appRoot . $localPath));
            }
        }
    }
13896
def load_modules(self, modules, config):
        """"""
        for pluginclass in get_plugin_classes(modules):
            name = pluginclass.__name__
            if name in config["enabledplugins"]:
                if issubclass(pluginclass, _ConnectionPlugin):
                    log.debug(LOG_PLUGIN, "Enable connection plugin %s", name)
                    self.connection_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ContentPlugin):
                    log.debug(LOG_PLUGIN, "Enable content plugin %s", name)
                    self.content_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ParserPlugin):
                    log.debug(LOG_PLUGIN, "Enable parser plugin %s", name)
                    self.parser_plugins.append(pluginclass(config[name]))
                else:
                    raise ValueError("Invalid plugin class %s" % pluginclass)
1234862
protected function scanLoadConfig(): void
    {
        /* @var SplFileInfo $directory */
        /* @var SplFileInfo $file */
        foreach (Finder::create()->directories()->depth(1)->name('Config')->in($this->modulePath()) as $directory) {
            foreach (Finder::create()->files()->name('*.php')->in($directory->getPathname()) as $file) {
                $this->mergeConfigFrom($file->getPathname(), Str::snake($directory->getRelativePath()));
            }
        }
    }
154243
public function load() {
		$this->specCsDecs = array();
		
		foreach ($this->moduleNamespaces as $moduleNamespace) {
			$moduleNamespace = (string) $moduleNamespace;
				
			if (!$this->modularConfigSource->containsModuleNamespace($moduleNamespace)) {
				$this->specCsDecs[$moduleNamespace] = null;
				continue;
			}
				
			$this->specCsDecs[$moduleNamespace] = new SpecConfigSourceDecorator(
					$this->modularConfigSource->getOrCreateConfigSourceByModuleNamespace($moduleNamespace), $moduleNamespace);
		}
	}
1360206
public function scanModules() {
        $modules = RtCache::get('loader@modules');
        if (!$modules) {
            $modules = [];
            if (is_dir(MODULE_ROOT)) {
                $it = new \DirectoryIterator (MODULE_ROOT);
                foreach ($it as $dir) {
                    if ($dir->isDot()) {
                        continue;
                    }
                    if ($dir->isDir()) {
                        $dirname = $dir->getFilename();
                        $boot    = MODULE_ROOT . $dirname . '/bootstrap.php';
                        if (is_file($boot)) {
                            $modules[ $dirname ] = $boot;
                        }
                    }
                }
            }
            RtCache::add('loader@modules', $modules);
        }

        return $modules;
    }
1210480
public function loadModuleDependencies($module)
    {
        $config = $module->getConfig();
        if (isset($config['modules'])) {
            $this->loadConfig($config, $module);
        }
    }