예제 #1
0
파일: PsrUri.php 프로젝트: kaiwa/http
 /**
  * Return an instance with the specified query string.
  *
  * This method MUST retain the state of the current instance, and return
  * an instance that contains the specified query string.
  *
  * Users can provide both encoded and decoded query characters.
  * Implementations ensure the correct encoding as outlined in getQuery().
  *
  * An empty query string value is equivalent to removing the query string.
  *
  * @param  string|array  $query  The query string to use with the new instance.
  *
  * @return  static  A new instance with the specified query string.
  * @throws  \InvalidArgumentException for invalid query strings.
  */
 public function withQuery($query)
 {
     if (is_array($query)) {
         $query = UriHelper::buildQuery($query);
     }
     $query = UriHelper::filterQuery($query);
     $new = clone $this;
     $new->vars = UriHelper::parseQuery($query);
     $new->query = $query;
     return $new;
 }
예제 #2
0
파일: PsrUri.php 프로젝트: asika32764/http
 /**
  * Return an instance with the specified query string.
  *
  * This method MUST retain the state of the current instance, and return
  * an instance that contains the specified query string.
  *
  * Users can provide both encoded and decoded query characters.
  * Implementations ensure the correct encoding as outlined in getQuery().
  *
  * An empty query string value is equivalent to removing the query string.
  *
  * @param  string|array  $query  The query string to use with the new instance.
  *
  * @return  static  A new instance with the specified query string.
  * @throws  \InvalidArgumentException for invalid query strings.
  */
 public function withQuery($query)
 {
     if (!is_string($query)) {
         throw new \InvalidArgumentException('URI query should be a string or array');
     }
     $query = UriHelper::filterQuery($query);
     $new = clone $this;
     $new->vars = UriHelper::parseQuery($query);
     $new->query = $query;
     return $new;
 }