try { //check of the routes configuration file exists if (!file_exists(__DIR__ . '/../application/routes.php')) { throw new Exceptions\BaseException("The defined routes file cannot be found! Please restore if you deleted"); } //get the defined routes $routes = (include __DIR__ . '/../application/routes.php'); } catch (Exceptions\BaseException $error) { $error->show(); return; } $routeObj = new Drivers\Routes\Implementation(); //there is a defined route if ($routeObj->dispatch($url, $routes)) { //get the controller name ($controller = $routeObj->getController()) || ($controller = 'Home'); //get the action name ($action = $routeObj->getMethod()) || ($action = 'Index'); //get parameters $parameters = $routeObj->getParameters(); } else { //create an instance of the url parser $urlObj = new Drivers\Utilities\UrlParser($url); //get the controller name ($controller = $urlObj->getController()) || ($controller = 'Home'); //get the action name ($action = $urlObj->getMethod()) || ($action = 'Index'); //get parameters $parameters = $urlObj->getParameters(); } //check if this class and method exists
try { //check of the routes configuration file exists if (!file_exists(__DIR__ . '/../application/routes.php')) { throw new Exceptions\BaseException("The defined routes file cannot be found! Please restore if you deleted"); } //get the defined routes $routes = (include __DIR__ . '/../application/routes.php'); } catch (Exceptions\BaseException $error) { $error->show(); return; } $routeObj = new Drivers\Routes\Implementation(); //there is a defined route if ($routeObj->dispatch(Drivers\Registry::getUrl(), $routes)) { //get the controller name ($controller = $routeObj->getController()) || ($controller = $config['default']['controller']); //get the action name ($action = $routeObj->getMethod()) || ($action = $config['default']['action']); //get parameters $parameters = $routeObj->getParameters(); } else { //create an instance of the url parser $urlObj = new Drivers\Utilities\UrlParser(Drivers\Registry::getUrl()); //get the controller name ($controller = $urlObj->getController()) || ($controller = $config['default']['controller']); //get the action name ($action = $urlObj->getMethod()) || ($action = $config['default']['action']); //get parameters $parameters = $urlObj->getParameters(); } //check if this class and method exists