Set the port that the request will be sent on
int $port Port number to set:
Overrides RequestInterface::setPort
public function setPort($port) {
$this->url
->setPort($port);
// Include the port in the Host header if it is not the default port for the scheme of the URL
$scheme = $this->url
->getScheme();
if ($scheme == 'http' && $port != 80 || $scheme == 'https' && $port != 443) {
$this->headers['host'] = new Header('Host', $this->url
->getHost() . ':' . $port);
}
else {
$this->headers['host'] = new Header('Host', $this->url
->getHost());
}
return $this;
}