userId; } /** * A portal ID. */ public function getPortalId(): ?string { return $this->portalId; } /** * A hash. */ public function getHash(): ?string { return $this->hash; } /** * An ID address. */ public function getIpAddress(): ?string { return $this->ipAddress; } /** * To create a secret. */ public function toCreateSecret(): bool { return $this->createSecret; } /** * @param array{ * userId: string, * portalId?: ?string, * hash?: ?string, * ipAddress?: ?string, * createSecret?: ?bool, * } $data */ public static function create(array $data): self { $obj = new self(); $userId = $data['userId'] ?? null; if (!$userId) { throw new RuntimeException("No user ID."); } $obj->userId = $userId; $obj->portalId = $data['portalId'] ?? null; $obj->hash = $data['hash'] ?? null; $obj->ipAddress = $data['ipAddress'] ?? null; $obj->createSecret = $data['createSecret'] ?? false; return $obj; } }