|
1 | 1 | <?php |
2 | 2 | namespace LaunchDarkly; |
3 | 3 |
|
4 | | - |
5 | | -class LDUserBuilder { |
6 | | - protected $_key = null; |
7 | | - protected $_secondary = null; |
8 | | - protected $_ip = null; |
9 | | - protected $_country = null; |
10 | | - protected $_email = null; |
11 | | - protected $_name = null; |
12 | | - protected $_avatar = null; |
13 | | - protected $_firstName = null; |
14 | | - protected $_lastName = null; |
15 | | - protected $_custom = []; |
16 | | - |
17 | | - public function __construct($key) { |
18 | | - $this->_key = $key; |
19 | | - } |
20 | | - |
21 | | - public function secondary($secondary) { |
22 | | - $this->_secondary = $secondary; |
23 | | - return $this; |
24 | | - } |
25 | | - |
26 | | - public function ip($ip) { |
27 | | - $this->_ip = $ip; |
28 | | - return $this; |
29 | | - } |
30 | | - |
31 | | - public function country($country) { |
32 | | - $this->_country = $country; |
33 | | - return $this; |
34 | | - } |
35 | | - |
36 | | - public function email($email) { |
37 | | - $this->_email = $email; |
38 | | - return $this; |
39 | | - } |
40 | | - |
41 | | - public function name($name) { |
42 | | - $this->_name = $name; |
43 | | - return $this; |
44 | | - } |
45 | | - |
46 | | - public function avatar($avatar) { |
47 | | - $this->_avatar = $avatar; |
48 | | - return $this; |
49 | | - } |
50 | | - |
51 | | - public function firstName($firstName) { |
52 | | - $this->_firstName = $firstName; |
53 | | - return $this; |
54 | | - } |
55 | | - |
56 | | - public function lastName($lastName) { |
57 | | - $this->_lastName = $lastName; |
58 | | - return $this; |
59 | | - } |
60 | | - |
61 | | - public function custom($custom) { |
62 | | - $this->_custom = $custom; |
63 | | - return $this; |
64 | | - } |
65 | | - |
66 | | - public function build() { |
67 | | - return new LDUser($this->_key, $this->_secondary, $this->_ip, $this->_country, $this->_email, $this->_name, $this->_avatar, $this->_firstName, $this->_lastName, $this->_custom); |
68 | | - } |
69 | | - |
70 | | -} |
71 | | - |
72 | 4 | /** |
73 | 5 | * Contains specific attributes of a user browsing your site. The only mandatory property property is the key, |
74 | 6 | * which must uniquely identify each user. For authenticated users, this may be a username or e-mail address. For anonymous users, |
|
0 commit comments