コード例 #1
0
ファイル: Router.php プロジェクト: jivoo/http
 /**
  * Get URI for a route.
  *
  * @param string|array|Route|HasRoute $route A route.
  * @return Message\Uri Uri.
  */
 public function getUri($route, $full = false)
 {
     $route = $this->validate($route);
     $path = $this->getPathValidated($route);
     if (is_string($path)) {
         return new Message\Uri($path);
     }
     if ($full) {
         $uri = $this->request->getUri()->withPath($this->request->pathToString($path));
     } else {
         $uri = new Message\Uri($this->request->pathToString($path));
     }
     $uri = $uri->withQuery(http_build_query($route->getQuery()))->withFragment($route->getFragment());
     return $uri;
 }