$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 { //get the namespaced controller class $controller = 'Controllers\\' . ucwords($controller) . 'Controller'; if (!class_exists($controller)) { throw new Exceptions\BaseException("The class " . $controller . ' is undefined'); } if (!(int) method_exists($controller, $action)) { //create instance of this object $dispatch = new $controller(); //throw exception if no method can be found if (!$dispatch->{$action}()) {
if ($UrlParserObjectInstance->getController() !== null) { //check if there is a defined route matched if ($RouteParserObject->matchRoute()) { //if there is a defined route, set the controller, method and parameter properties $RouteParserObject->setController()->setMethod()->setParameters(); //set the value of the controller $controller = $RouteParserObject->getController(); //set the value of the method ($action = $RouteParserObject->getMethod()) || ($action = $config['default']['action']); } else { //set the parameter properties $RouteParserObject->setParameters(); //get the controller name $controller = $UrlParserObjectInstance->getController(); //set the value of the method ($action = $UrlParserObjectInstance->getMethod()) || ($action = $config['default']['action']); } } else { //set the parameter properties $RouteParserObject->setParameters(); //get the default controller name $controller = $config['default']['controller']; //get the default action name $action = $config['default']['action']; } //check if this class and method exists try { //get the namespaced controller class $controller = 'Controllers\\' . ucwords($controller) . 'Controller'; if (!class_exists($controller)) { throw new Drivers\Routes\RouteException("Drivers\\Routes\\RouteException : The class " . $controller . ' is undefined');
$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 try { //get the namespaced controller class $controller = 'Controllers\\' . ucwords($controller) . 'Controller'; if (!class_exists($controller)) { throw new Exceptions\BaseException("The class " . $controller . ' is undefined'); } if (!(int) method_exists($controller, $action)) { //create instance of this object $dispatch = new $controller(); //throw exception if no method can be found if (!$dispatch->{$action}()) {