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