/** * Instanciate a controller from a name. * * @param string $controllerClass * @param \Puzzlout\Framework\Core\Route $route * @return \Puzzlout\Framework\Controllers\BaseController * @throws \Exception : when the controller class can't be instanciated. */ protected function InstanciateController($controllerClass, Route $route) { try { return new $controllerClass($this, $route->module(), $route->action()); } catch (\Exception $exc) { $this->error->LogError($exc); throw new \Exception("Controller not loaded", Enums\ErrorCodes\FrameworkControllerConstants::ControllerNotLoadedValue, $exc); } }
/** * Search for a match route in the last of routes based on a relative url from * the current request. * * @param Route $route the instance of the Route to use in the current request. * @param string $url relative url of the current request. * @return mixed \Puzzlout\Framework\Core\Route | \Exception * @throws \Exception Is thrown if FrameworkConstants::"APP_BASE_URL" is not set. */ public function getRoute(Route $route, $url) { $route->Init($url); }