public function whichModule($object){
        $reflection = new \ReflectionClass($object);
        $ns = explode('\\', $reflection->getNamespaceName());
        
        if (class_exists($ns[0] . '\Module')) {
            $reflection = new \ReflectionClass($ns[0] . '\Module');
            return strtolower(basename(dirname($reflection->getFileName())));
        } else {
            $path = $reflection->getFileName();
            $dirs = $this->getOption('module_dirs');
             
            foreach($dirs as $dir){
                $dir = realpath($dir);
            
                if(strpos($path, $dir) === 0){
                    $dir = substr($path, strlen($dir));
                    $dir = ltrim($dir, DIRECTORY_SEPARATOR);
            
                    $a = explode(DIRECTORY_SEPARATOR, $dir);
                    return strtolower($a[0]);
                }
            }
        }

        return null;
    }
public function whichModule($object){
        $reflection = new \ReflectionClass($object);
        $ns = explode('\\', $reflection->getNamespaceName());
        
        if (class_exists($ns[0] . '\Module')) {
            $reflection = new \ReflectionClass($ns[0] . '\Module');
            return strtolower(basename(dirname($reflection->getFileName())));
        } else {
            $path = $reflection->getFileName();
            $dirs = $this->getOption('module_dirs');
             
            foreach($dirs as $dir){
                $dir = realpath($dir);
            
                if(strpos($path, $dir) === 0){
                    $dir = substr($path, strlen($dir));
                    $dir = ltrim($dir, DIRECTORY_SEPARATOR);
            
                    $a = explode(DIRECTORY_SEPARATOR, $dir);
                    return strtolower($a[0]);
                }
            }
        }

        return null;
    }
public function whichModule ( $ object ) { $ reflection = new \ ReflectionClass ( $ object ) ; $ ns = explode ( '\\' , $ reflection -> getNamespaceName ( ) ) ; if ( class_exists ( $ ns [ 0 ] . '\Module' ) ) { $ reflection = new \ ReflectionClass ( $ ns [ 0 ] . '\Module' ) ; return strtolower ( basename ( dirname ( $ reflection -> getFileName ( ) ) ) ) ; } else { $ path = $ reflection -> getFileName ( ) ; $ dirs = $ this -> getOption ( 'module_dirs' ) ; foreach ( $ dirs as $ dir ) { $ dir = realpath ( $ dir ) ; if ( strpos ( $ path , $ dir ) === 0 ) { $ dir = substr ( $ path , strlen ( $ dir ) ) ; $ dir = ltrim ( $ dir , DIRECTORY_SEPARATOR ) ; $ a = explode ( DIRECTORY_SEPARATOR , $ dir ) ; return strtolower ( $ a [ 0 ] ) ; } } } return null ; }
Detect the name of the module based on class

@param object $object Setup instance
@return string|null Module name
Detect the name of the module based on class