/**
  * @inheritdocs
  */
 public function GetRoute($uri = "")
 {
     // reset the uri cache
     $this->uri = '';
     if ($uri == "") {
         $uri = RequestUtil::GetMethod() . ":" . $this->GetUri();
     }
     // literal match check
     if (isset($this->routeMap[$uri])) {
         // expects mapped values to be in the form: Controller.Model
         list($controller, $method) = explode(".", $this->routeMap[$uri]["route"]);
         $this->matchedRoute = array("key" => $this->routeMap[$uri], "route" => $this->routeMap[$uri]["route"], "params" => isset($this->routeMap[$uri]["params"]) ? $this->routeMap[$uri]["params"] : array());
         return array($controller, $method);
     }
     // loop through the route map for wild cards:
     foreach ($this->routeMap as $key => $value) {
         $unalteredKey = $key;
         // convert wild cards to RegEx.
         // currently only ":any" and ":num" are supported wild cards
         $key = str_replace(':any', '.+', $key);
         $key = str_replace(':num', '[0-9]+', $key);
         // check for RegEx match
         if (preg_match('#^' . $key . '$#', $uri)) {
             $this->matchedRoute = array("key" => $unalteredKey, "route" => $value["route"], "params" => isset($value["params"]) ? $value["params"] : array());
             // expects mapped values to be in the form: Controller.Model
             list($controller, $method) = explode(".", $value["route"]);
             return array($controller, $method);
         }
     }
     // this is a page-not-found route
     $this->matchedRoute = array("key" => '', "route" => '', "params" => array());
     // if we haven't returned by now, we've found no match:
     return explode('.', self::$ROUTE_NOT_FOUND, 2);
 }
 /**
  * Returns the controller and method for the given URI
  *
  * @param string the url, if not provided will be obtained using the current URL
  * @return array($controller,$method)
  */
 public function GetRoute($uri = "")
 {
     $match = '';
     $qs = $uri ? $uri : (array_key_exists('QUERY_STRING', $_SERVER) ? $_SERVER['QUERY_STRING'] : '');
     $parsed = explode('&', $qs, 2);
     $action = $parsed[0];
     if (strpos($action, '=') > -1 || !$action) {
         // the querystring is empty or the first param is a named param, which we ignore
         $match = $this->defaultAction;
     } else {
         // otherwise we have a route.  see if we have a match in the routemap, otherwise return the 'not found' route
         $method = RequestUtil::GetMethod();
         $route = $method . ':' . $action;
         $match = array_key_exists($route, $this->routes) ? $this->routes[$route]['route'] : self::$ROUTE_NOT_FOUND;
     }
     return explode('.', $match, 2);
 }