Exemple #1
0
 /**
  * Routes the urls 
  *
  * @param InterfaceRequest $pRequest
  */
 public function route(InterfaceRequest $pRequest)
 {
     // getting the path info
     $uri = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
     // create empty parameters (none found so far)
     $params = array();
     // try to match all the routes to the uri
     foreach ($this->objRouteQueue as $route) {
         // get params if route is found
         $params = $route->match($uri);
         // if params are found, process them
         if (is_array($params) === true) {
             // load params into the request
             foreach ($params as $key => $value) {
                 // add key & value
                 $pRequest->setParam($key, $value);
             }
             // don't match other routes
             break;
         }
     }
     // return params
     return $params;
 }