public function withScheme($scheme)
{
if (!is_string($scheme)) {
throw new InvalidArgumentException(sprintf('%s expects a string argument; received %s', __METHOD__, is_object($scheme) ? get_class($scheme) : gettype($scheme)));
}
$scheme = $this->filterScheme($scheme);
if ($scheme === $this->scheme) {
// Do nothing if no change was made.
return clone $this;
}
$new = clone $this;
$new->scheme = $scheme;
return $new;
}