コード例 #1
0
ファイル: Candidate.php プロジェクト: reoring/sabel
 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));
 }
コード例 #2
0
ファイル: Configurator.php プロジェクト: reoring/sabel
 public static function clearRoutes()
 {
     self::$routes = array();
 }