Core/ModuleHelper.php
public function getModuleNameSpace()
    {
        $module = $this->module;
        $package = $this->getComposerPackage();
        $sModulePath = $module->getModulePath();
        if ($package) {
            $autoload = $package->getAutoload();
        } else {
            $sModulesDir = Registry::getConfig()->getModulesDir();
            $file = $sModulesDir . $sModulePath . '/composer.json';
            if (file_exists($file)) {
                $data = json_decode(file_get_contents($file), true);
                $autoload = $data["autoload"];
            }
        }

        if ($autoload) {
            $namesspaces = $autoload["psr-4"];
            $prefix = array_keys($namesspaces);
            $moduleNameSpace = $prefix[0];
            return $moduleNameSpace;
        }


        $moduleNameSpace = '';
        $composerClassLoader = $this->getAutoloader();
        $nameSpacePrefixes = $composerClassLoader->getPrefixesPsr4();
        foreach ($nameSpacePrefixes as $nameSpacePrefix => $paths) {
            foreach ($paths as $path) {
                if (strpos($path, $sModulePath) !== false) {
                    $moduleNameSpace = $nameSpacePrefix;

                    return $moduleNameSpace;
                }
            }
        }

        return $moduleNameSpace;
    }
public function getModuleNameSpace()
    {
        $module = $this->module;
        $package = $this->getComposerPackage();
        $sModulePath = $module->getModulePath();
        if ($package) {
            $autoload = $package->getAutoload();
        } else {
            $sModulesDir = Registry::getConfig()->getModulesDir();
            $file = $sModulesDir . $sModulePath . '/composer.json';
            if (file_exists($file)) {
                $data = json_decode(file_get_contents($file), true);
                $autoload = $data["autoload"];
            }
        }

        if ($autoload) {
            $namesspaces = $autoload["psr-4"];
            $prefix = array_keys($namesspaces);
            $moduleNameSpace = $prefix[0];
            return $moduleNameSpace;
        }


        $moduleNameSpace = '';
        $composerClassLoader = $this->getAutoloader();
        $nameSpacePrefixes = $composerClassLoader->getPrefixesPsr4();
        foreach ($nameSpacePrefixes as $nameSpacePrefix => $paths) {
            foreach ($paths as $path) {
                if (strpos($path, $sModulePath) !== false) {
                    $moduleNameSpace = $nameSpacePrefix;

                    return $moduleNameSpace;
                }
            }
        }

        return $moduleNameSpace;
    }
@param Module $module

@return string