1 | <?php |
||
5 | class User |
||
6 | { |
||
7 | protected $xmppJid; |
||
8 | |||
9 | protected $deleted; |
||
10 | |||
11 | protected $name; |
||
12 | |||
13 | protected $lastActive; |
||
14 | |||
15 | protected $title; |
||
16 | |||
17 | protected $links; |
||
18 | |||
19 | //protected $presence; |
||
20 | |||
21 | protected $created; |
||
22 | |||
23 | protected $id; |
||
24 | |||
25 | protected $mentionName; |
||
26 | |||
27 | protected $groupAdmin; |
||
28 | |||
29 | protected $timezone; |
||
30 | |||
31 | protected $guest; |
||
32 | |||
33 | protected $email; |
||
34 | |||
35 | protected $photoUrl; |
||
36 | |||
37 | /** |
||
38 | * Builds a user object from server response if json given, otherwise creates an empty object |
||
39 | * Works with partial and full user information. |
||
40 | * |
||
41 | * @param array $json json_decoded response in json given by the server |
||
42 | * |
||
43 | */ |
||
44 | public function __construct($json = null) |
||
53 | |||
54 | /** |
||
55 | * Parses response given by the API and maps the fields to User object |
||
56 | * |
||
57 | * @param array $json json_decoded response in json given by the server |
||
58 | * |
||
59 | * @return void |
||
60 | */ |
||
61 | public function parseJson($json) |
||
82 | |||
83 | public function toJson() |
||
95 | |||
96 | /** |
||
97 | * Sets XMPP/Jabber ID of the user. |
||
98 | * |
||
99 | * @param string $xmppJid XMPP/Jabber ID of the user |
||
100 | * |
||
101 | * @return self |
||
102 | */ |
||
103 | public function setXmppJid($xmppJid) |
||
108 | |||
109 | /** |
||
110 | * Returns XMPP/Jabber ID of the user. |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | public function getXmppJid() |
||
118 | |||
119 | /** |
||
120 | * Sets whether the user has been deleted or not |
||
121 | * |
||
122 | * @param boolean $deleted Whether the user has been deleted or not |
||
123 | * |
||
124 | * @return self |
||
125 | */ |
||
126 | public function setDeleted($deleted) |
||
131 | |||
132 | /** |
||
133 | * Returns whether the user has been deleted or not |
||
134 | * |
||
135 | * @return boolean |
||
136 | */ |
||
137 | public function isDeleted() |
||
141 | |||
142 | /** |
||
143 | * Sets user's full name |
||
144 | * |
||
145 | * @param string $name User's full name |
||
146 | * |
||
147 | * @return self |
||
148 | */ |
||
149 | public function setName($name) |
||
154 | |||
155 | /** |
||
156 | * Returns user's full name |
||
157 | * |
||
158 | * @return string |
||
159 | */ |
||
160 | public function getName() |
||
164 | |||
165 | /** |
||
166 | * Sets when the user was last active |
||
167 | * |
||
168 | * @param \Datetime $lastActive When the user was last active |
||
169 | * |
||
170 | * @return self |
||
171 | */ |
||
172 | public function setLastActive($lastActive) |
||
177 | |||
178 | /** |
||
179 | * Returns when the user was last active |
||
180 | * |
||
181 | * @return \Datetime |
||
182 | */ |
||
183 | public function getLastActive() |
||
187 | |||
188 | /** |
||
189 | * Sets user's title |
||
190 | * |
||
191 | * @param mixed $title User's title |
||
192 | * |
||
193 | * @return self |
||
194 | */ |
||
195 | public function setTitle($title) |
||
200 | |||
201 | /** |
||
202 | * Returns user's title |
||
203 | * |
||
204 | * @return mixed |
||
205 | */ |
||
206 | public function getTitle() |
||
210 | |||
211 | /** |
||
212 | * Sets when the user was created |
||
213 | * |
||
214 | * @param \Datetime $created When the user was created |
||
215 | * |
||
216 | * @return self |
||
217 | */ |
||
218 | public function setCreated($created) |
||
223 | |||
224 | /** |
||
225 | * Returns when the user was created |
||
226 | * |
||
227 | * @return \Datetime |
||
228 | */ |
||
229 | public function getCreated() |
||
233 | |||
234 | /** |
||
235 | * Sets user's ID |
||
236 | * |
||
237 | * @param mixed $id User's ID |
||
238 | * |
||
239 | * @return self |
||
240 | */ |
||
241 | public function setId($id) |
||
246 | |||
247 | /** |
||
248 | * Returns user's ID |
||
249 | * |
||
250 | * @return mixed |
||
251 | */ |
||
252 | public function getId() |
||
256 | |||
257 | /** |
||
258 | * Sets user's @mention name |
||
259 | * |
||
260 | * @param mixed $mentionName User's @mention name |
||
261 | * |
||
262 | * @return self |
||
263 | */ |
||
264 | public function setMentionName($mentionName) |
||
269 | |||
270 | /** |
||
271 | * Returns user's @mention name |
||
272 | * |
||
273 | * @return mixed |
||
274 | */ |
||
275 | public function getMentionName() |
||
279 | |||
280 | /** |
||
281 | * Sets whether or not this user is an admin of the group |
||
282 | * |
||
283 | * @param boolean $groupAdmin Whether or not this user is an admin of the group |
||
284 | * |
||
285 | * @return self |
||
286 | */ |
||
287 | public function setGroupAdmin($groupAdmin) |
||
292 | |||
293 | /** |
||
294 | * Returns whether or not this user is an admin of the group |
||
295 | * |
||
296 | * @return boolean |
||
297 | */ |
||
298 | public function isGroupAdmin() |
||
302 | |||
303 | /** |
||
304 | * Sets the desired user timezone |
||
305 | * |
||
306 | * @param string $timezone The desired user timezone |
||
307 | * |
||
308 | * @return self |
||
309 | */ |
||
310 | public function setTimezone($timezone) |
||
315 | |||
316 | /** |
||
317 | * Returns the desired user timezone |
||
318 | * |
||
319 | * @return mixed |
||
320 | */ |
||
321 | public function getTimezone() |
||
325 | |||
326 | /** |
||
327 | * Sets whether or not this user is a guest or registered user |
||
328 | * |
||
329 | * @param boolean $guest Whether or not this user is a guest or registered user |
||
330 | * |
||
331 | * @return self |
||
332 | */ |
||
333 | public function setGuest($guest) |
||
338 | |||
339 | /** |
||
340 | * Returns whether or not this user is a guest or registered user |
||
341 | * |
||
342 | * @return boolean |
||
343 | */ |
||
344 | public function isGuest() |
||
348 | |||
349 | /** |
||
350 | * Sets user's email |
||
351 | * |
||
352 | * @param string $email User's email |
||
353 | * |
||
354 | * @return self |
||
355 | */ |
||
356 | public function setEmail($email) |
||
361 | |||
362 | /** |
||
363 | * Returns user's email |
||
364 | * |
||
365 | * @return string |
||
366 | */ |
||
367 | public function getEmail() |
||
371 | |||
372 | /** |
||
373 | * Sets URL to user's photo. |
||
374 | * |
||
375 | * @param string $photoUrl URL to user's photo |
||
376 | * |
||
377 | * @return self |
||
378 | */ |
||
379 | public function setPhotoUrl($photoUrl) |
||
384 | |||
385 | /** |
||
386 | * Returns URL to user's photo. 125px on the longest side |
||
387 | * |
||
388 | * @return string |
||
389 | */ |
||
390 | public function getPhotoUrl() |
||
394 | } |
||
395 |