Пример #1
0
 /**
  * Return an instance with the specified scheme.
  *
  * This method MUST retain the state of the current instance, and return
  * an instance that contains the specified scheme.
  *
  * Implementations MUST support the schemes "http" and "https" case
  * insensitively, and MAY accommodate other schemes if required.
  *
  * An empty scheme is equivalent to removing the scheme.
  *
  * @param   string  $scheme  The scheme to use with the new instance.
  *
  * @return  static  A new instance with the specified scheme.
  *
  * @throws  \InvalidArgumentException for invalid or unsupported schemes.
  */
 public function withScheme($scheme)
 {
     if (!is_string($scheme)) {
         throw new \InvalidArgumentException('URI Scheme should be a string.');
     }
     $scheme = UriHelper::filterScheme($scheme);
     $new = clone $this;
     $new->scheme = $scheme;
     return $new;
 }