1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Trello\Model; |
4
|
|
|
|
5
|
|
|
use Trello\Exception\InvalidArgumentException; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @codeCoverageIgnore |
9
|
|
|
*/ |
10
|
|
|
class Member extends AbstractObject implements MemberInterface |
11
|
|
|
{ |
12
|
|
|
protected $apiName = 'member'; |
13
|
|
|
|
14
|
|
|
protected $loadParams = array( |
15
|
|
|
'fields' => 'all', |
16
|
|
|
); |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @return string |
20
|
|
|
*/ |
21
|
|
|
public function getId() |
22
|
|
|
{ |
23
|
|
|
return $this->data['id']; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* {@inheritdoc} |
28
|
|
|
*/ |
29
|
|
|
public function setAvatarHash($avatarHash) |
30
|
|
|
{ |
31
|
|
|
$this->data['avatarHash'] = $avatarHash; |
32
|
|
|
|
33
|
|
|
return $this; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* {@inheritdoc} |
38
|
|
|
*/ |
39
|
|
|
public function getAvatarHash() |
40
|
|
|
{ |
41
|
|
|
return $this->data['avatarHash']; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritdoc} |
46
|
|
|
*/ |
47
|
|
|
public function setBio($bio) |
48
|
|
|
{ |
49
|
|
|
$this->data['bio'] = $bio; |
50
|
|
|
|
51
|
|
|
return $this; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* {@inheritdoc} |
56
|
|
|
*/ |
57
|
|
|
public function getBio() |
58
|
|
|
{ |
59
|
|
|
return $this->data['bio']; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* {@inheritdoc} |
64
|
|
|
*/ |
65
|
|
|
public function getBioData() |
66
|
|
|
{ |
67
|
|
|
return $this->data['bioData']; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* {@inheritdoc} |
72
|
|
|
*/ |
73
|
|
|
public function setConfirmed($confirmed) |
74
|
|
|
{ |
75
|
|
|
$this->data['confirmed'] = $confirmed; |
76
|
|
|
|
77
|
|
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* {@inheritdoc} |
82
|
|
|
*/ |
83
|
|
|
public function isConfirmed() |
84
|
|
|
{ |
85
|
|
|
return $this->data['confirmed']; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* {@inheritdoc} |
90
|
|
|
*/ |
91
|
|
|
public function setFullName($fullName) |
92
|
|
|
{ |
93
|
|
|
$this->data['fullName'] = $fullName; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* {@inheritdoc} |
100
|
|
|
*/ |
101
|
|
|
public function getFullName() |
102
|
|
|
{ |
103
|
|
|
return $this->data['fullName']; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* {@inheritdoc} |
108
|
|
|
*/ |
109
|
|
|
public function setIdPremOrgsAdmin(array $idPremOrgsAdmin) |
110
|
|
|
{ |
111
|
|
|
$this->data['idPremOrgsAdmin'] = $idPremOrgsAdmin; |
112
|
|
|
|
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* {@inheritdoc} |
118
|
|
|
*/ |
119
|
|
|
public function getIdPremOrgsAdmin() |
120
|
|
|
{ |
121
|
|
|
return $this->data['idPremOrgsAdmin']; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* {@inheritdoc} |
126
|
|
|
*/ |
127
|
|
|
public function setInitials($initials) |
128
|
|
|
{ |
129
|
|
|
$this->data['initials'] = $initials; |
130
|
|
|
|
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* {@inheritdoc} |
136
|
|
|
*/ |
137
|
|
|
public function getInitials() |
138
|
|
|
{ |
139
|
|
|
return $this->data['initials']; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* {@inheritdoc} |
144
|
|
|
*/ |
145
|
|
|
public function setMemberType($memberType) |
146
|
|
|
{ |
147
|
|
|
if (!in_array($memberType, array('admin', 'normal', 'observer'))) { |
148
|
|
|
throw new InvalidArgumentException(sprintf( |
149
|
|
|
'The member type %s does not exist.', |
150
|
|
|
$memberType |
151
|
|
|
)); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
$this->data['memberType'] = $memberType; |
155
|
|
|
|
156
|
|
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* {@inheritdoc} |
161
|
|
|
*/ |
162
|
|
|
public function getMemberType() |
163
|
|
|
{ |
164
|
|
|
return $this->data['memberType']; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* {@inheritdoc} |
169
|
|
|
*/ |
170
|
|
|
public function setProducts(array $products) |
171
|
|
|
{ |
172
|
|
|
$this->data['products'] = $products; |
173
|
|
|
|
174
|
|
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* {@inheritdoc} |
179
|
|
|
*/ |
180
|
|
|
public function getProducts() |
181
|
|
|
{ |
182
|
|
|
return $this->data['products']; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* {@inheritdoc} |
187
|
|
|
*/ |
188
|
|
|
public function setStatus($status) |
189
|
|
|
{ |
190
|
|
|
$this->data['status'] = $status; |
191
|
|
|
|
192
|
|
|
return $this; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* {@inheritdoc} |
197
|
|
|
*/ |
198
|
|
|
public function getStatus() |
199
|
|
|
{ |
200
|
|
|
return $this->data['status']; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* {@inheritdoc} |
205
|
|
|
*/ |
206
|
|
|
public function setUrl($url) |
207
|
|
|
{ |
208
|
|
|
$this->data['url'] = $url; |
209
|
|
|
|
210
|
|
|
return $this; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* {@inheritdoc} |
215
|
|
|
*/ |
216
|
|
|
public function getUrl() |
217
|
|
|
{ |
218
|
|
|
return $this->data['url']; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* {@inheritdoc} |
223
|
|
|
*/ |
224
|
|
|
public function setUsername($username) |
225
|
|
|
{ |
226
|
|
|
$this->data['username'] = $username; |
227
|
|
|
|
228
|
|
|
return $this; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* {@inheritdoc} |
233
|
|
|
*/ |
234
|
|
|
public function getUsername() |
235
|
|
|
{ |
236
|
|
|
return $this->data['username']; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* {@inheritdoc} |
241
|
|
|
*/ |
242
|
|
|
public function setAvatarSource($avatarSource) |
243
|
|
|
{ |
244
|
|
|
$this->data['avatarSource'] = $avatarSource; |
245
|
|
|
|
246
|
|
|
return $this; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* {@inheritdoc} |
251
|
|
|
*/ |
252
|
|
|
public function getAvatarSource() |
253
|
|
|
{ |
254
|
|
|
return $this->data['avatarSource']; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* {@inheritdoc} |
259
|
|
|
*/ |
260
|
|
|
public function setEmail($email) |
261
|
|
|
{ |
262
|
|
|
$this->data['email'] = $email; |
263
|
|
|
|
264
|
|
|
return $this; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* {@inheritdoc} |
269
|
|
|
*/ |
270
|
|
|
public function getEmail() |
271
|
|
|
{ |
272
|
|
|
return $this->data['email']; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* {@inheritdoc} |
277
|
|
|
*/ |
278
|
|
|
public function setGravatarHash($gravatarHash) |
279
|
|
|
{ |
280
|
|
|
$this->data['gravatarHash'] = $gravatarHash; |
281
|
|
|
|
282
|
|
|
return $this; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* {@inheritdoc} |
287
|
|
|
*/ |
288
|
|
|
public function getGravatarHash() |
289
|
|
|
{ |
290
|
|
|
return $this->data['gravatarHash']; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* {@inheritdoc} |
295
|
|
|
*/ |
296
|
|
|
public function setBoardIds(array $boardIds) |
297
|
|
|
{ |
298
|
|
|
$this->data['idBoards'] = $boardIds; |
299
|
|
|
|
300
|
|
|
return $this; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* {@inheritdoc} |
305
|
|
|
*/ |
306
|
|
|
public function getBoardIds() |
307
|
|
|
{ |
308
|
|
|
return $this->data['idBoards']; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* {@inheritdoc} |
313
|
|
|
*/ |
314
|
|
View Code Duplication |
public function getBoards() |
|
|
|
|
315
|
|
|
{ |
316
|
|
|
$boards = array(); |
317
|
|
|
|
318
|
|
|
foreach ($this->data['idBoards'] as $boardId) { |
319
|
|
|
$boards[] = new Board($this->client, $boardId); |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
return $boards; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* {@inheritdoc} |
327
|
|
|
*/ |
328
|
|
|
public function setPinnedBoardIds(array $pinnedBoardIds) |
329
|
|
|
{ |
330
|
|
|
$this->data['idBoardsPinned'] = $pinnedBoardIds; |
331
|
|
|
|
332
|
|
|
return $this; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* {@inheritdoc} |
337
|
|
|
*/ |
338
|
|
|
public function getPinnedBoardIds() |
339
|
|
|
{ |
340
|
|
|
return $this->data['idBoardsPinned']; |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* {@inheritdoc} |
345
|
|
|
*/ |
346
|
|
View Code Duplication |
public function getPinnedBoards() |
|
|
|
|
347
|
|
|
{ |
348
|
|
|
$boards = array(); |
349
|
|
|
|
350
|
|
|
foreach ($this->data['idBoardsPinned'] as $boardId) { |
351
|
|
|
$boards[] = new Board($this->client, $boardId); |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
return $boards; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* {@inheritdoc} |
359
|
|
|
*/ |
360
|
|
|
public function setOrganizationIds(array $organizationIds) |
361
|
|
|
{ |
362
|
|
|
$this->data['idOrganizations'] = $organizationIds; |
363
|
|
|
|
364
|
|
|
return $this; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* {@inheritdoc} |
369
|
|
|
*/ |
370
|
|
|
public function getOrganizationIds() |
371
|
|
|
{ |
372
|
|
|
return $this->data['idOrganizations']; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* {@inheritdoc} |
377
|
|
|
*/ |
378
|
|
|
public function getOrganizations() |
379
|
|
|
{ |
380
|
|
|
$organizations = array(); |
381
|
|
|
|
382
|
|
|
foreach ($this->data['idOrganizations'] as $organizationId) { |
383
|
|
|
$organizations[] = new Organization($this->client, $organizationId); |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
return $organizations; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* {@inheritdoc} |
391
|
|
|
*/ |
392
|
|
|
public function setLoginTypes($loginTypes) |
393
|
|
|
{ |
394
|
|
|
$this->data['loginTypes'] = $loginTypes; |
395
|
|
|
|
396
|
|
|
return $this; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* {@inheritdoc} |
401
|
|
|
*/ |
402
|
|
|
public function getLoginTypes() |
403
|
|
|
{ |
404
|
|
|
return $this->data['loginTypes']; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* {@inheritdoc} |
409
|
|
|
*/ |
410
|
|
|
public function setNewEmail($newEmail) |
411
|
|
|
{ |
412
|
|
|
$this->data['newEmail'] = $newEmail; |
413
|
|
|
|
414
|
|
|
return $this; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* {@inheritdoc} |
419
|
|
|
*/ |
420
|
|
|
public function setOneTimeMessagesDismissed(array $messages) |
421
|
|
|
{ |
422
|
|
|
$this->data['oneTimeMessagesDismissed'] = $messages; |
423
|
|
|
|
424
|
|
|
return $this; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* {@inheritdoc} |
429
|
|
|
*/ |
430
|
|
|
public function getOneTimeMessagesDismissed() |
431
|
|
|
{ |
432
|
|
|
return $this->data['oneTimeMessagesDismissed']; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* {@inheritdoc} |
437
|
|
|
*/ |
438
|
|
|
public function setPreferences(array $prefs) |
439
|
|
|
{ |
440
|
|
|
$this->data['prefs'] = $prefs; |
441
|
|
|
|
442
|
|
|
return $this; |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** |
446
|
|
|
* {@inheritdoc} |
447
|
|
|
*/ |
448
|
|
|
public function getPreferences() |
449
|
|
|
{ |
450
|
|
|
return $this->data['prefs']; |
451
|
|
|
} |
452
|
|
|
|
453
|
|
|
/** |
454
|
|
|
* {@inheritdoc} |
455
|
|
|
*/ |
456
|
|
|
public function setTrophies(array $trophies) |
457
|
|
|
{ |
458
|
|
|
$this->data['trophies'] = $trophies; |
459
|
|
|
|
460
|
|
|
return $this; |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* {@inheritdoc} |
465
|
|
|
*/ |
466
|
|
|
public function getTrophies() |
467
|
|
|
{ |
468
|
|
|
return $this->data['trophies']; |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* {@inheritdoc} |
473
|
|
|
*/ |
474
|
|
|
public function setUploadedAvatarHash($uploadedAvatarHash) |
475
|
|
|
{ |
476
|
|
|
$this->data['uploadedAvatarHash'] = $uploadedAvatarHash; |
477
|
|
|
|
478
|
|
|
return $this; |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
/** |
482
|
|
|
* {@inheritdoc} |
483
|
|
|
*/ |
484
|
|
|
public function getUploadedAvatarHash() |
485
|
|
|
{ |
486
|
|
|
return $this->data['uploadedAvatarHash']; |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* {@inheritdoc} |
491
|
|
|
*/ |
492
|
|
|
public function setPremiumFeatures(array $premiumFeatures) |
493
|
|
|
{ |
494
|
|
|
$this->data['premiumFeatures'] = $premiumFeatures; |
495
|
|
|
|
496
|
|
|
return $this; |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
/** |
500
|
|
|
* {@inheritdoc} |
501
|
|
|
*/ |
502
|
|
|
public function getPremiumFeatures() |
503
|
|
|
{ |
504
|
|
|
return $this->data['premiumFeatures']; |
505
|
|
|
} |
506
|
|
|
} |
507
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.