host = $host; $this->port = $port; } public function getHost(): string { return $this->host; } public function hasPort(): bool { return $this->port > 0; } public function getPort(): int { return $this->port; } public static function parse(HttpHeader $header): HostHeader { $parts = explode(':', $header->getFirstLine(), 2); return new HostHeader($parts[0], (int)($parts[1] ?? '-1')); } }