Returns a generator for a module.

@param ModuleInterface $module

@return UrlGeneratorInterface
962994
public function getGeneratorForModule(ModuleInterface $module)
    {
        $type       = $module->getModularType();
        $collection = $this->getRouteCollectionForType($type);

        if (array_key_exists($type, $this->generators)) {
            return $this->generators[$type];
        }

        if (null === $this->options['cache_dir']) {
            return $this->generators[$type] = new $this->options['generator_class']($collection, $this->context, $this->logger);
        }

        $cacheClass = sprintf('%s_UrlGenerator', $type);

        $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'] . '/' . $cacheClass .'.php',
            function (ConfigCacheInterface $cache) use ($cacheClass, $collection) {
                /** @var GeneratorDumperInterface $dumper */
                $dumper = new $this->options['generator_dumper_class']($collection);

                $options = [
                    'class'      => $cacheClass,
                    'base_class' => $this->options['generator_base_class'],
                ];

                $cache->write($dumper->dump($options), $collection->getResources());
            }
        );

        require_once $cache->getPath();

        return $this->generators[$type] = new $cacheClass($this->context, $this->logger);
    }
441960
public function getModuleManager()
    {
        if (null === $this->moduleManager) {
            $this->moduleManager = $this->serviceManager->get('ModuleManager');
        }

        return $this->moduleManager;
    }
1059224
public function getLoader(): LoaderInterface
    {
        if (!isset($this->i__loader)) {
            $this->i__loader = new DelegateLoader();
        }

        return $this->i__loader;
    }
1018258
private static function buildModuleSerial(\core_kernel_classes_Resource $module)
    {
        $returnValue = (string) '';

        
        $uri = explode('#', $module->getUri());
		list($type, $extId) = explode('_', $uri[1]);
        $returnValue = self::SERIAL_PREFIX_MODULE . $extId . urlencode($module->getUri());
        

        return (string) $returnValue;
    }
636694
public function getModule() {
		
		$class	= 'Module';
		$id		= $this->moduleId;
		
		if (!$this->issetCache($class)) {
			$this->setCache($class, new Module($id));
		}
		
		return $this->getCache($class);
		
	}
843501
public function getClassByModule($module): ?string
    {
        if ($module instanceof Module || $module instanceof ModuleModel) {
            return Module::findClass($module->type);
        }

        if (\is_string($module)) {
            return Module::findClass($module);
        }

        return null;
    }
1068671
public function generate(GeneratorInterface $generator)
    {
        $callback = function () use ($generator) {
            $handler = Handler::create($generator);
            $handler->generate();
        };

        return $callback();
    }
399521
public static function getModuleMenu($module=null, $parent=null) 
	{
		$moduleInfo = self::getModuleInfo($module, $parent);
		$moduleMenu = $moduleInfo['plugin_menu'];
		
		if($moduleMenu != null) {
			foreach ($moduleMenu as $key => $val) {
				$moduleSubmenu = $val['submenu'];
				if($moduleSubmenu != null) {
					$moduleSubmenuData = array_filter($moduleSubmenu, function($a) {
						$siteType = explode(',', $a['urlRules']['siteType']);
						$userLevel = explode(',', $a['urlRules']['userLevel']);
						
						return in_array(OmmuSettings::getInfo('site_type'), $siteType) && in_array(!Yii::app()->user->isGuest ? Yii::app()->user->level : 0, $userLevel);
					});
					$moduleMenu[$key]['submenu'] = array_values($moduleSubmenuData);	
				}
			}
			
			$moduleMenuData = array_filter($moduleMenu, function($a) {
				$siteType = explode(',', $a['urlRules']['siteType']);
				$userLevel = explode(',', $a['urlRules']['userLevel']);
				return in_array(OmmuSettings::getInfo('site_type'), $siteType) && in_array(!Yii::app()->user->isGuest ? Yii::app()->user->level : 0, $userLevel);
			});
			return array_values($moduleMenuData);
			
		} else
			return false;
	}
1247224
public function getModule ($module)
	{
		
		// Load modules
		
		$this->getModules ();
		
		// Loop through the modules
		
		foreach ($this->modules as $obj)
		{
			
			// If the module names match and the class exists
			
			if (strtolower ($obj->get ('name')) == $module && class_exists ($obj->getModuleClass ()))
			{
				
				// Return the module
				
				return $obj;
				
			}
			
		}
		
		// Return FALSE
		
		return FALSE;
		
	}
903903
public function getModule($moduleName) {
        $moduleName = strtolower($moduleName);
        if (isset(self::$_modules[$moduleName])) {
            return self::$_modules[$moduleName];
        } else {
            try {
                return $this->loadModule($moduleName);
            }
            catch (\Exception $e) {
                throw new ModuleException("Cannot find requested module: $moduleName");
            }
        }
    }
584839
public function getGenerator()
    {
        if (null !== $this->generator) {
            return $this->generator;
        }

        $compiled = is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) && UrlGenerator::class === $this->options['generator_base_class'];

        if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
            $routes = $this->getRouteCollection();
            if ($compiled) {
                $routes = (new CompiledUrlGeneratorDumper($routes))->getCompiledRoutes();
            }
            $this->generator = new $this->options['generator_class']($routes, $this->context, $this->logger, $this->defaultLocale);
        } else {
            $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['generator_cache_class'].'.php',
                function (ConfigCacheInterface $cache) {
                    $dumper = $this->getGeneratorDumperInstance();

                    $options = [
                        'class' => $this->options['generator_cache_class'],
                        'base_class' => $this->options['generator_base_class'],
                    ];

                    $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
                }
            );

            if ($compiled) {
                $this->generator = new $this->options['generator_class'](require $cache->getPath(), $this->context, $this->logger);
            } else {
                if (!class_exists($this->options['generator_cache_class'], false)) {
                    require_once $cache->getPath();
                }

                $this->generator = new $this->options['generator_cache_class']($this->context, $this->logger, $this->defaultLocale);
            }
        }

        if ($this->generator instanceof ConfigurableRequirementsInterface) {
            $this->generator->setStrictRequirements($this->options['strict_requirements']);
        }

        return $this->generator;
    }
137095
public function getModuleVersion($module)
    {
        $config = $this->getModuleDefinition($module);
    
        if (isset($config['version'])) {
            return $config['version'];
        } else {
            return SoftwareVersion::DEFAULT_UNRESOLVED_VERSION;
        }
    }
441673
protected function getModuleOutput($module)
    {
        $console = $this->console;

        $head = sprintf(
            "%s\n%s\n%s\n",
            str_repeat(
                '-',
                $console->getWidth()
            ),
            'Testing Module: ' . $module,
            str_repeat(
                '-',
                $console->getWidth()
            )
        );

        return $console->colorize($head, ColorInterface::BLUE);
    }
102830
public function getModuleDeps($module)
    {
        $module = strtolower($module);
        
        if (!isset($this->deps[$module])) {
            $map     = array();
            $deps    = array();
            $modules = $this->findModules();
    
            foreach ($modules as $name) {
                $config     = $this->getModuleDefinition($name);
                $map[$name] = isset($config['name']) ? $config['name'] : null;
            }
    
            $config = $this->getModuleDefinition($module);
            
            foreach (['require', 'require-dev'] as $key) {
                if (isset($config[$key])) {
                    foreach ($config[$key] as $composerName => $composerVersion) {
                        $moduleName = array_search($composerName, $map);
        
                        if ($moduleName !== false) {
                            $deps[$moduleName] = ltrim($composerVersion, '<>=');
                        }
                    }
                }
            }
    
            $this->deps[$module] = $deps;
        }
    
        return $this->deps[$module];
    }
248780
private function getGenerator(string $documentClass): AbstractGenerator
    {
        if (!array_key_exists($documentClass, $this->generatorsCache)) {
            $metadata = $this->metadataFactory->getClassMetadata($documentClass);
            $this->generatorsCache[$documentClass] = $metadata->isNested()
                ? new NestedProxyGenerator($metadata, $this, $this->proxiesNamespace)
                : new RootProxyGenerator($metadata, $this, $this->proxiesNamespace);
        }

        return $this->generatorsCache[$documentClass];
    }
1334314
protected function getGlobalMiddleWareHandlers(): Generator
    {
        // select global middleware from routes
        foreach ($this->selectClasses($this->getRoutesPath(), RoutesConfiguratorInterface::class) as $selectClass) {
            /** @var RoutesConfiguratorInterface $selectClass */
            foreach ($selectClass::getMiddleware() as $middlewareClass) {
                $handler = [$middlewareClass, MiddlewareInterface::MIDDLEWARE_METHOD_NAME];
                yield $handler;
            }
        }

        // select global middleware from providers
        $interfaceName = ProvidesMiddlewareInterface::class;
        foreach ($this->selectClassImplements($this->getProviderClasses(), $interfaceName) as $providerClass) {
            /** @var ProvidesMiddlewareInterface $providerClass */
            foreach ($providerClass::getMiddleware() as $middlewareClass) {
                $handler = [$middlewareClass, MiddlewareInterface::MIDDLEWARE_METHOD_NAME];
                yield $handler;
            }
        }
    }
823605
protected function getModuleConfig(string $module, array $options = []): ModuleConfig
    {
        $mc = new ModuleConfig(ConfigType::FIELDS(), $module, null, ['cacheSkip' => true]);

        $schema = $mc->createSchema(['lint' => true]);
        $mc->setParser(new Parser($schema, ['lint' => true, 'validate' => true]));

        return $mc;
    }