Formatting

This commit is contained in:
Dennis Eichhorn 2016-01-17 16:09:10 +01:00
parent 27c4001ee8
commit 956aebb640

View File

@ -431,11 +431,11 @@ class ModuleManager
foreach ($module as $m) { foreach ($module as $m) {
$this->initModule($m); $this->initModule($m);
} }
} elseif (is_string($module)) { } elseif (is_string($module) && realpath(self::MODULE_PATH . '/' . $module . '/Controller.php') !== false) {
$this->running[$module] = ModuleFactory::getInstance($module, $this->app); $this->running[$module] = ModuleFactory::getInstance($module, $this->app);
$this->app->dispatcher->set($this->running[$module], '\Modules\\' . $module . '\\Controller'); $this->app->dispatcher->set($this->running[$module], '\Modules\\' . $module . '\\Controller');
} else { } else {
throw new \InvalidArgumentException('Unknown parameter'); throw new \InvalidArgumentException('Invalid Module');
} }
} }
@ -451,7 +451,11 @@ class ModuleManager
*/ */
public function get(\string $module) public function get(\string $module)
{ {
return isset($this->running[$module]) ? $this->running[$module] : null; if (!isset($this->running[$module])) {
$this->initModule($module);
}
return $this->running[$module];
} }
/** /**