/**
  * build breadcrumb
  * @param HTTP_GET HTTP Get Request
  * @return void
  */
 public function build($httpRequest)
 {
     $router = new \library\router();
     $routes = $router->getAllRoutes();
     foreach ($routes as $route) {
         if (preg_match('`^' . $route->getUrl() . '[\\w\\W]*$`', $httpRequest->requestUrl(), $matches)) {
             preg_match_all('/([0-9]{1,10})+\\-([\\w\\W][^\\/]+)/', $httpRequest->requestUrl(), $matchesURL);
             foreach ($matchesURL[0] as $url) {
                 $route->setUrl(preg_replace('/(\\(\\[0\\-9\\]{1\\,10}\\)\\+\\\\-\\[\\\\w\\\\W\\]\\+)/', $url, $route->getUrl(), 1));
             }
             $this->items[] = $route;
         }
     }
 }
 /**
  * get a controller
  * get the controller to use by the URL and the file routes.xml
  * @return object instance of a controller object
  */
 public function getController()
 {
     $router = new \library\router();
     // try to get the route corresponding to the URL
     // if the getRoute() method can't find the route, call error404 method
     try {
         $matchedRoute = $router->getRoute($this->httpRequest->requestUrl());
     } catch (\RuntimeException $e) {
         $this->httpResponse->redirect404();
     }
     // add the variables of the route to the GET session
     $_GET = array_merge($_GET, $matchedRoute->getVars());
     // run the controller found in the route
     preg_match_all('/([\\w]*)\\\\([\\w]*)$/', $matchedRoute->getModule(), $modules);
     if (!isset($modules[2][0])) {
         $controller = 'applications\\modules\\' . $matchedRoute->getModule() . '\\' . $matchedRoute->getModule() . 'Controller';
     } else {
         $controller = 'applications\\modules\\' . $modules[1][0] . '\\' . $modules[2][0] . 'Controller';
     }
     return new $controller($this, $matchedRoute->getModule(), $matchedRoute->getAction());
 }
 /**
  * get the controller to call with the current URL.
  * @return object controller
  */
 public function getController()
 {
     //instanciate the router.
     $router = new \library\router();
     // try to get the route corresponding to the URL and return the associate controller.
     try {
         //get the route.
         $matchedRoute = $router->getRoute($this->httpRequest->requestUrl());
         $_GET = array_merge($_GET, $matchedRoute->getVars());
         // define the controller of the route.
         preg_match_all('/([\\w]*)\\\\([\\w]*)$/', $matchedRoute->getModule(), $modules);
         if (!isset($modules[2][0])) {
             $controller = 'applications\\modules\\' . $matchedRoute->getModule() . '\\' . $matchedRoute->getModule() . 'Controller';
         } else {
             $controller = 'applications\\modules\\' . $modules[1][0] . '\\' . $modules[2][0] . 'Controller';
         }
         return new $controller($this, $matchedRoute->getModule(), $matchedRoute->getAction());
     } catch (\RuntimeException $e) {
         if (ENABLE_REDIRECT_404 == 1) {
             $this->httpResponse->redirect404();
         }
     }
 }