hostname) { $this->hostname = (static fn (mixed $h): string => \is_string($h) ? $h : '')(gethostname()); } if ('' === $this->userAgent) { $this->userAgent = 'nsqphp/'.InstalledVersions::getPrettyVersion('nsq/nsq'); } if ($this->snappy && $this->deflate) { throw new InvalidArgumentException('Client cannot enable both [snappy] and [deflate]'); } } /** * @phpstan-ignore-next-line */ public function jsonSerialize(): array { return [ 'client_id' => $this->clientId, 'deflate' => $this->deflate, 'deflate_level' => $this->deflateLevel, 'feature_negotiation' => $this->featureNegotiation, 'heartbeat_interval' => $this->heartbeatInterval, 'hostname' => $this->hostname, 'msg_timeout' => $this->msgTimeout, 'sample_rate' => $this->sampleRate, 'tls_v1' => $this->tls, 'user_agent' => $this->userAgent, ]; } }