Find uniqueId module by it's className in module/application.
Will find only latest className in inheritance chain.
@param string $moduleClassName full class name with namespace
@param \yii\base\Module $moduleContainer
@return string|false module uniqueId
336253
public static function getModuleUidByClassname($moduleClassName, $moduleContainer = null)
    {
        if ($moduleContainer == null) {
            $moduleContainer = Yii::$app; // start from ancestor-container
        }
        if ($moduleContainer instanceof YiiBaseModule) {
             if ($moduleContainer::className() == $moduleClassName) {
                 return $moduleContainer->uniqueId;
             }
             $subModules = $moduleContainer->getModules($loadedOnly = false);
             foreach ($subModules as $subModule) {
                 $uid = static::getModuleUidByClassname($moduleClassName, $subModule);
                 if ($uid) return $uid;
             }
        }
        return false;
    }
782858
protected function get_module_name() {
        if (isset(self::$modulename)) {
            return self::$modulename;
        }
        self::$modulename = get_string('modulename', 'assign');
        return self::$modulename;
    }
145983
protected function getBestModuleForKey($entitiesByModule, $key)
    {
        // Check classes
        $class = current(explode('.', $key));
        if (array_key_exists($class, $this->classModuleCache)) {
            return $this->classModuleCache[$class];
        }
        $owner = $this->findModuleForClass($class);
        if ($owner) {
            $this->classModuleCache[$class] = $owner;
            return $owner;
        }

        // @todo - How to determine ownership of templates? Templates can
        // exist in multiple locations with the same name.

        // Display notice if not found
        Debug::message(
            "Duplicate key {$key} detected in no / multiple modules with no obvious owner",
            false
        );

        // Fall back to framework then cms modules
        foreach (array('framework', 'cms') as $module) {
            if (isset($entitiesByModule[$module][$key])) {
                $this->classModuleCache[$class] = $module;
                return $module;
            }
        }

        // Do nothing
        $this->classModuleCache[$class] = null;
        return null;
    }
1161457
public static function moduleUserIdentity()
    {
        if (empty(static::$_moduleUserIdentity)) {
            $module = Yii::$app->getModule(static::parameter('userModuleUniqueId'));
            if (!empty($module) && $module instanceof UniModule) {
                $result = $module->getDataModel(static::parameter('userManagerAlias'));
                static::$_moduleUserIdentity = $result;
            }
        }

        //return null; // use for debug
        return static::$_moduleUserIdentity;
    }
418483
public static function storageIdByClass($className)
    {
        foreach (self::storageHandlers() as $id => $handler) {
            if ($handler instanceof $className) {
                return $id;
            }
        }
        return null;
    }
975227
public function load($packageName) {
		if ($this->loadedModules->has($packageName)) {
			return $this->loadedModules->get($packageName);
		}

		// check existence
		if (!$this->installedModules->has($packageName)) {
			throw new ModuleException(sprintf('Module (%s) does not exist.', $packageName), 500);
		}

		// check activation
		if (!$this->activatedModules->has($packageName)) {
			throw new ModuleException(sprintf('Module (%s) not activated', $packageName), 501);
		}

		$model = $this->activatedModules->get($packageName);

		if ($model->getInstalledVersion() > $model->getActivatedVersion()) {
			throw new ModuleException(sprintf('Module Version Mismatch (%s). Module needs to be updated by the Administrator', $packageName), 500);
		}

		// load
		$className = $model->getClassName();

		/* @var $module AbstractModule */
		$module = new $className($model, $this->service);
		$this->loadedModules->set($packageName, $module);

		// load locale
		$localeService = $this->getServiceContainer()->getLocaleService();
		$file = sprintf('/%s/locales/{locale}/translations.json', $packageName);
		$localeService->loadLocaleFile($file, $module->getCanonicalName());

		return $module;
	}
1345056
public function renderWindowClassView($className, $namespace, $moduleId)
    {
        $alias = Inflector::humanize(Inflector::camel2words($className));
        return $this->view->render('@admin/commands/views/aw/classfile.php', [
            'className' => $className,
            'namespace' => $namespace,
            'luyaText' => $this->getGeneratorText('aw/create'),
            'moduleId' => $moduleId,
            'alias' => $alias,
        ]);
    }
762288
protected function getClassIdFromModuleMap($className)
    {
        $moduleControllerMapProvider = $this->getModuleControllerMapProvider();
        $idToNameMap = $moduleControllerMapProvider->getControllerMap();
        $classId = $this->arrayLookup($className, array_flip($idToNameMap));

        return $classId;
    }
1112038
public function findModuleByIdentity($identity)
    {
        $field = $this->getModularIdentifier();

        if (null == $field) {
            throw new \InvalidArgumentException('The module manager is missing a modular identifier.');
        }

        return $this->repository->findOneBy([$field => $identity]);
    }
1126091
public function getNormalizeModuleNameByClassName($className)
    {
        if (!array_key_exists($className, $this->normalizeModuleNameByClassName)) {
            $moduleName = $this->getModuleNameByClassName($className);
            $this->normalizeModuleNameByClassName[$className] = rtrim($moduleName, '\\');
        }

        return $this->normalizeModuleNameByClassName[$className];
    }
795777
public static function hasClass($domElement, $className) {
        $classAttr = $domElement->class;
        $classNames = explode(" ", $classAttr);

        return in_array($className, $classNames);
    }
208201
public function getModule($moduleName)
    {
        if (!$this->hasModule($moduleName)) {
            throw new ModuleException(__CLASS__, "Module $moduleName couldn't be connected");
        }

        return $this->modules[$moduleName];
    }
67767
public static function exists(string $moduleName, array $options = []) : bool
    {
        $config = (new ModuleConfig(ConfigType::MIGRATION(), $moduleName, null, $options))->parseToArray();
        if (empty($config)) {
            return false;
        }

        $config = (new ModuleConfig(ConfigType::MODULE(), $moduleName, null, $options))->parseToArray();
        if (empty($config['table']) || empty($config['table']['type'])) {
            return false;
        }

        return true;
    }
1333740
@Override
    public List<String> getInjectionClasses(Container moduleContainer) {
        final List<String> listOfClassNames = new ArrayList<String>();
        
        for(WebAppInjectionClassListCollaborator collab: webAppInjectionClassListCollaborators.services()){
            listOfClassNames.addAll(collab.getInjectionClasses(moduleContainer));
        }
        
        return listOfClassNames;
    }
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;
    }
674545
public static function registeredModuleName($moduleUid)
    {
        if (!empty(static::$_dynModulesCache[$moduleUid]['name'])) {
            $name = static::$_dynModulesCache[$moduleUid]['name'];
            return $name;
        }
        return false;
    }
322358
public function moduleExists($moduleName, $returnId = false)
    {
        $module = $this->findOrFalse('module_name', $moduleName);
        if ($module)
        {
            if ($returnId)
                return $module->module_id;
            else
                return true;
        }

        return false;
    }