host; } public function port(): int { return $this->port; } public function security(): ConnectionSecurity { return $this->security; } public function username(): ?string { return $this->username; } public function password(): ?string { return $this->password; } public function hasCredentials(): bool { return $this->username !== null && $this->password !== null; } public function timeout(): float { return $this->timeout; } public function verifyPeer(): bool { return $this->verifyPeer; } public function verifyPeerName(): bool { return $this->verifyPeerName; } public function allowSelfSigned(): bool { return $this->allowSelfSigned; } public function endpoint(): string { return sprintf('%s://%s:%d', $this->security->transport(), $this->host, $this->port); } public function streamContextOptions(): array { return [ 'ssl' => [ 'verify_peer' => $this->verifyPeer, 'verify_peer_name' => $this->verifyPeerName, 'allow_self_signed' => $this->allowSelfSigned, 'SNI_enabled' => true, 'peer_name' => $this->host, ], ]; } }