]> git.mxchange.org Git - friendica.git/blobdiff - src/App/ModuleController.php
Move contact conversation to its own module class
[friendica.git] / src / App / ModuleController.php
index 013859de9d8408ef2661f76bf7e359a265695fe1..ae27236398387cc5dce72c71363a6301958cd740 100644 (file)
@@ -81,7 +81,7 @@ class ModuleController
        private $moduleName;
 
        /**
-        * @var ICanHandleRequests The module class
+        * @var ?ICanHandleRequests The module object
         */
        private $module;
 
@@ -104,9 +104,9 @@ class ModuleController
        }
 
        /**
-        * @return ICanHandleRequests The base module object
+        * @return ?ICanHandleRequests The base module object
         */
-       public function getModule(): ICanHandleRequests
+       public function getModule(): ?ICanHandleRequests
        {
                return $this->module;
        }
@@ -120,12 +120,10 @@ class ModuleController
                return $this->isBackend;
        }
 
-       public function __construct(string $moduleName = self::DEFAULT, ICanHandleRequests $module = null, bool $isBackend = false, bool $printNotAllowedAddon = false)
+       public function __construct(string $moduleName = self::DEFAULT, ?ICanHandleRequests $module = null, bool $isBackend = false, bool $printNotAllowedAddon = false)
        {
-               $defaultClass = static::DEFAULT_CLASS;
-
                $this->moduleName           = $moduleName;
-               $this->module               = $module ?? new $defaultClass();
+               $this->module               = $module;
                $this->isBackend            = $isBackend;
                $this->printNotAllowedAddon = $printNotAllowedAddon;
        }
@@ -152,7 +150,6 @@ class ModuleController
                }
 
                $isBackend = in_array($module, ModuleController::BACKEND_MODULES);
-               ;
 
                return new ModuleController($module, null, $isBackend, $this->printNotAllowedAddon);
        }
@@ -298,8 +295,6 @@ class ModuleController
 
                Core\Hook::callAll($this->moduleName . '_mod_init', $placeholder);
 
-               $this->module->init();
-
                $profiler->set(microtime(true) - $timestamp, 'init');
 
                if ($server['REQUEST_METHOD'] === Router::DELETE) {