public function Uri::withScheme in Lockr 7.3
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.
Parameters
string $scheme The scheme to use with the new instance.:
Return value
static A new instance with the specified scheme.
Throws
\InvalidArgumentException for invalid or unsupported schemes.
Overrides UriInterface::withScheme
File
- vendor/
guzzlehttp/ psr7/ src/ Uri.php, line 422
Class
- Uri
- PSR-7 URI implementation.
Namespace
GuzzleHttp\Psr7Code
public function withScheme($scheme) {
$scheme = $this
->filterScheme($scheme);
if ($this->scheme === $scheme) {
return $this;
}
$new = clone $this;
$new->scheme = $scheme;
$new
->removeDefaultPort();
$new
->validateState();
return $new;
}