public function getModuleOfTypeName(string $typeName, bool $required = true) {
		$typeName = trim($typeName, '\\');
		
		$module = null;
		$nsLength = 0;
		foreach ($this->modules as $curNamespace => $curModule) {
			if (!StringUtils::startsWith($curNamespace . '\\', $typeName)) continue;
			
			$curNsLength = strlen($curNamespace);
			if ($curNsLength > $nsLength) {
				$module = $curModule;
				$nsLength = $curNsLength;
			}
		}
		
		if (!$required || $module !== null) return $module;
				
		throw new UnknownModuleException('Type is not part of any installed modules: ' . $typeName);
	}