Ejemplo n.º 1
0
 public function uri($param = "")
 {
     if ($param === null) {
         $param = "";
     } elseif (!is_string($param)) {
         $message = __METHOD__ . "() argument must be a string.";
         throw new Sabel_Exception_InvalidArgument($message);
     }
     if ($param !== "" && strpos($param, ",") === false && strpos($param, ":") === false) {
         return ltrim($param, "/");
     }
     $parameters = array();
     if ($param === "") {
         $parameters = array_merge($this->destination, $this->uriParameters);
     } else {
         foreach (explode(",", $param) as $param) {
             list($key, $val) = array_map("trim", explode(":", $param));
             if ($key === "n") {
                 $key = "name";
             }
             $parameters[$key] = $val;
         }
     }
     $name = isset($parameters["name"]) ? $parameters["name"] : $this->name;
     $route = Sabel_Map_Configurator::getRoute($name);
     return $route->createUrl($parameters, array_merge($this->destination, $this->uriParameters));
 }
Ejemplo n.º 2
0
 public static function clearRoutes()
 {
     self::$routes = array();
 }