userId; } public function getPortalId(): ?string { return $this->portalId; } public function getHash(): ?string { return $this->hash; } public function getIpAddress(): ?string { return $this->ipAddress; } public function toCreateSecret(): bool { return $this->createSecret; } public static function create(array $data): self { $object = new self(); $object->userId = $data['userId'] ?? null; $object->portalId = $data['portalId'] ?? null; $object->hash = $data['hash'] ?? null; $object->ipAddress = $data['ipAddress'] ?? null; $object->createSecret = $data['createSecret'] ?? false; $object->validate(); return $object; } private function validate(): void { if (!$this->userId) { throw new RuntimeException("No user ID."); } } }