src/i18n/TextCollection/i18nTextCollector.php
protected function findModuleForClass($class)
    {
        if (ClassInfo::exists($class)) {
            $module = ClassLoader::inst()
                ->getManifest()
                ->getOwnerModule($class);
            if ($module) {
                return $module->getName();
            }
        }

        // If we can't find a class, see if it needs to be fully qualified
        if (strpos($class, '\\') !== false) {
            return null;
        }

        // Find FQN that ends with $class
        $classes = preg_grep(
            '/' . preg_quote("\\{$class}", '\/') . '$/i',
            ClassLoader::inst()->getManifest()->getClassNames()
        );

        // Find all modules for candidate classes
        $modules = array_unique(array_map(function ($class) {
            $module = ClassLoader::inst()->getManifest()->getOwnerModule($class);
            return $module ? $module->getName() : null;
        }, $classes));

        if (count($modules) === 1) {
            return reset($modules);
        }

        // Couldn't find it! Exists in none, or multiple modules.
        return null;
    }
protected function findModuleForClass($class)
    {
        if (ClassInfo::exists($class)) {
            $module = ClassLoader::inst()
                ->getManifest()
                ->getOwnerModule($class);
            if ($module) {
                return $module->getName();
            }
        }

        // If we can't find a class, see if it needs to be fully qualified
        if (strpos($class, '\\') !== false) {
            return null;
        }

        // Find FQN that ends with $class
        $classes = preg_grep(
            '/' . preg_quote("\\{$class}", '\/') . '$/i',
            ClassLoader::inst()->getManifest()->getClassNames()
        );

        // Find all modules for candidate classes
        $modules = array_unique(array_map(function ($class) {
            $module = ClassLoader::inst()->getManifest()->getOwnerModule($class);
            return $module ? $module->getName() : null;
        }, $classes));

        if (count($modules) === 1) {
            return reset($modules);
        }

        // Couldn't find it! Exists in none, or multiple modules.
        return null;
    }
protected function findModuleForClass ( $ class ) { if ( ClassInfo :: exists ( $ class ) ) { $ module = ClassLoader :: inst ( ) -> getManifest ( ) -> getOwnerModule ( $ class ) ; if ( $ module ) { return $ module -> getName ( ) ; } } // If we can't find a class, see if it needs to be fully qualified if ( strpos ( $ class , '\\' ) !== false ) { return null ; } // Find FQN that ends with $class $ classes = preg_grep ( '/' . preg_quote ( "\\{$class}" , '\/' ) . '$/i' , ClassLoader :: inst ( ) -> getManifest ( ) -> getClassNames ( ) ) ; // Find all modules for candidate classes $ modules = array_unique ( array_map ( function ( $ class ) { $ module = ClassLoader :: inst ( ) -> getManifest ( ) -> getOwnerModule ( $ class ) ; return $ module ? $ module -> getName ( ) : null ; } , $ classes ) ) ; if ( count ( $ modules ) === 1 ) { return reset ( $ modules ) ; } // Couldn't find it! Exists in none, or multiple modules. return null ; }
Given a partial class name, attempt to determine the best module to assign strings to.

@param string $class Either a FQN class name, or a non-qualified class name.
@return string Name of module
Given a partial class name attempt to determine the best module to assign strings to .