You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Contains specific attributes of a user browsing your site.
9
+
*
10
+
* LDUser supports only a subset of the behaviors that are available with the newer {@see \LaunchDarkly\LDContext}
11
+
* type. An LDUser is equivalent to an individual LDContext that has a `kind` of {@see \LaunchDarkly\LDContext::DEFAULT_KIND};
12
+
* it also has more constraints on attribute values than LDContext does (for instance, built-in attributes such as
13
+
* {@see \LaunchDarkly\LDUserBuilder::email()} can only have string values). Older LaunchDarkly SDKs only had the
14
+
* LDUser model, and the LDUser type has been retained for backward compatibility, but it may be removed in a
15
+
* future SDK version. Therefore, developers are recommended to migrate toward using LDContext.
16
+
*
17
+
* The only mandatory property property is the key, which must uniquely identify each user. For authenticated users,
18
+
* this may be a username or e-mail address. For anonymous users, it could be an IP address or session ID.
19
+
*
20
+
* Use {@see \LaunchDarkly\LDUserBuilder} to construct instances of this class.
21
+
*/
22
+
class LDUser
23
+
{
24
+
protectedstring$_key;
25
+
protected ?string$_ip = null;
26
+
protected ?string$_country = null;
27
+
protected ?string$_email = null;
28
+
protected ?string$_name = null;
29
+
protected ?string$_avatar = null;
30
+
protected ?string$_firstName = null;
31
+
protected ?string$_lastName = null;
32
+
protected ?bool$_anonymous = false;
33
+
protected ?array$_custom = [];
34
+
protected ?array$_privateAttributeNames = [];
35
+
36
+
/**
37
+
* Constructor for directly creating an instance.
38
+
*
39
+
* It is preferable to use {@see LDUserBuilder} instead of this constructor.
40
+
*
41
+
* @param string $key Unique key for the user. For authenticated users, this may be a username or e-mail address. For anonymous users, this could be an IP address or session ID.
42
+
* @param string|null $secondary Obsolete parameter that is ignored if present, retained to avoid breaking code that called this constructor
43
+
* @param string|null $ip The user's IP address (optional)
44
+
* @param string|null $country The user's country, as an ISO 3166-1 alpha-2 code (e.g. 'US') (optional)
45
+
* @param string|null $email The user's e-mail address (optional)
46
+
* @param string|null $name The user's full name (optional)
47
+
* @param string|null $avatar A URL pointing to the user's avatar image (optional)
48
+
* @param string|null $firstName The user's first name (optional)
49
+
* @param string|null $lastName The user's last name (optional)
50
+
* @param bool|null $anonymous Whether this is an anonymous user
51
+
* @param array|null $custom Other custom attributes that can be used to create custom rules
0 commit comments