public function __construct($url, $callback)
 {
     parent::__construct();
     $this->setUrl($url);
     $this->setCallback($callback);
     $this->settings['aliases'] = array();
     $this->requestTypes = array();
 }
 public function renderRoute(RouterEntry $route)
 {
     $this->currentRoute = $route;
     // Load middlewares
     if ($route->getMiddleware()) {
         $this->loadClass($route->getMiddleware());
     }
     if (is_object($route->getCallback()) && is_callable($route->getCallback())) {
         // When the callback is a function
         call_user_func_array($route->getCallback(), $route->getParameters(), 404);
     } else {
         if (stripos($route->getCallback(), '@') > 0) {
             // When the callback is a method
             $controller = explode('@', $route->getCallback());
             $className = $route->getNamespace() . '\\' . $controller[0];
             $class = $this->loadClass($className);
             $this->loadedClass = $class;
             $method = $controller[1];
             if (!method_exists($class, $method)) {
                 throw new RouterException(sprintf('Method %s does not exist in class %s', $method, $className), 404);
             }
             call_user_func_array(array($class, $method), $route->getParameters());
         }
     }
 }