public function registerModule($name, $dir)
{
$name = strtolower($name);
if (!isset($this->registry["modules"][$name])) {
$module = new Module($this);
$module->_dir = $dir;
$module->_bootfile = "{$dir}/bootstrap.php";
$this->path($name, $dir);
$this->registry["modules"][$name] = $module;
$this->bootModule($module);
}
return $this->registry["modules"][$name];
}