Returns the port on which the request is made.
@api
string
public function getPort() {
if (self::$trustProxy && $this->headers
->has('X-Forwarded-Port')) {
return $this->headers
->get('X-Forwarded-Port');
}
return $this->server
->get('SERVER_PORT');
}