public static function classAutoLoader(string $class)
    {
        self::ensureDefines();
        
        $coreBaseNamespace = str_replace('\\', '/', __NAMESPACE__) . '/';
        
        $classWithNamespaceToLoad = str_replace('\\', '/', $class);
        $classWithRelativeNamespaceToLoad = str_replace($coreBaseNamespace, '', $classWithNamespaceToLoad);
        
        $namespaceToLoad = dirname($classWithNamespaceToLoad);
        $classToLoad = basename($classWithNamespaceToLoad);
        
        $classFileName = $classToLoad . EXT_PHP;
        
        $paths = array();
        
        $possibleParentConstants = array(
            Xentriq::CONST_DIR_CORE, // core directory
            Xentriq::CONST_DIR_LIBS, // libraries directory
            Xentriq::CONST_DIR_ADDONS, // addon directory
            Xentriq::CONST_DIR_ASSUMED_ROOT // assumed root directory
        );
        
        foreach ($possibleParentConstants as $possibleParentConstant) {
            // search core directory
            if (defined($possibleParentConstant)) {
                $parentPath = constant($possibleParentConstant);
                
                $paths[] = ($parentPath . '/' . $classFileName);
                $paths[] = ($parentPath . $classWithNamespaceToLoad . EXT_PHP);
                $paths[] = ($parentPath . strtolower(dirname($classWithRelativeNamespaceToLoad)) . '/' . $classFileName);
                
                // search paths with hyphen
                $segments = explode('/', $namespaceToLoad);
                
                for ($sidx = 1; $sidx <= (sizeof($segments)); $sidx++) {
                    $baseHyphenPath = implode('-', array_slice($segments, 0, $sidx));
                    $completeHyphenPath = $baseHyphenPath . CHAR_SLASH . implode('/', array_slice($segments, $sidx));
                    
                    $paths[] = ($parentPath . $baseHyphenPath . '/' . $classFileName);
                    $paths[] = ($parentPath . $completeHyphenPath . '/' . $classFileName);
                    $paths[] = ($parentPath . strtolower($baseHyphenPath) . '/' . $classFileName);
                    $paths[] = ($parentPath . strtolower($completeHyphenPath) . '/' . $classFileName);
                }
            }
        }
        
        foreach ($paths as $path) {
            if (is_file($path) && !class_exists($path)) {
                require_once $path;
                
                // exit loader
                return;
            }
        }
        
        // search in addons
        $classFile = Addons::searchAddonClassFile($class);
        if (is_file($classFile)) {
            require_once $classFile;
        }
    }