Example #1
0
 /**
  * Override the default implementation to return a routing object when passed a string instead of a request object.
  * @param \CHttpRequest|string $url the request or string to parse
  * @param string|null $verb the http verb to assume when parsing string urls
  *
  * @return array|bool|string false if the request or url could not be parsed, otherwise the route or routing object
  */
 public function parseUrl($url, $verb = 'GET')
 {
     if (!is_string($url)) {
         return parent::parseUrl($url);
     }
     $request = new Request();
     $request->setRequestType($verb);
     $request->setUrl($url);
     $oldGET = $_GET;
     $oldREQUEST = $_REQUEST;
     $_GET = array();
     $parsed = parent::parseUrl($request);
     $params = $_GET;
     $_GET = $oldGET;
     $_REQUEST = $oldREQUEST;
     if ($parsed === false) {
         return false;
     }
     array_unshift($params, $parsed);
     return $params;
 }