public function registerAutoloader($baseDir, $baseNs)
    {
        $baseNs = $baseNs[strlen($baseNs) - 1] == '\\' ? $baseNs : "{$baseNs}\\";
        $baseDir = rtrim($baseDir, '/');

        spl_autoload_register(
            function ($class) use ($baseDir, $baseNs) {
                if (strncmp($baseNs, $class, strlen($baseNs)) == 0) {
                    $filename = str_replace(
                        '\\',
                        '/',
                        $baseDir.'/'.substr($class, strlen($baseNs)).'.php'
                    );
                    if (file_exists($filename)) {
                        if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) {
                            $this->getLogger()->debug('automatic load file '.$filename);
                        }

                        include $filename;

                        if (defined('FOCUS_DEBUG') && FOCUS_DEBUG) {
                            $this->getLogger()->debug("file {$filename} loaded");
                        }
                    }
                }
            },
            true,
            false
        );
    }