requestObj = $request; $this->config = $config; } /** * @return object * @throws \Exception */ public function load() { // Check the correct controller and action is going to load based on the URI $module = ($this->requestObj->query->has('module')) ? $this->requestObj->query->get('module') : ''; $controller = ($this->requestObj->query->has('controller')) ? $this->requestObj->query->get('controller') : ''; $action = ($this->requestObj->query->has('action')) ? $this->requestObj->query->get('action') : ''; // Run Installer if database config hasn't been configured if (empty($module)) { // Check mandatory parameters are set if (!$this->config->has('app.default_route.module')) { throw new \RuntimeException('Default module has not been configured.'); } $module = $this->config->get('app.default_route.module'); } if (empty($controller)) { // Check mandatory parameters are set if (!$this->config->has('app.default_route.controller')) { throw new \RuntimeException('Default controller has not been configured.'); } $controller = $this->config->get('app.default_route.controller'); } if (empty($action)) { // Check mandatory parameters are set if (!$this->config->has('app.default_route.action')) { throw new \RuntimeException('Default action has not been configured.'); } $action = $this->config->get('app.default_route.action'); } $format = 'SuiteCRM\Core\Modules\%s\Controller\%s'; $controller = sprintf($format, ucfirst($module), ucfirst($controller)); // run the controller action return (object)[ 'module' => $module, 'controller' => $controller, 'action' => 'action' . ucfirst($action) ]; } }