1 | <?php |
||
20 | class PulseUser extends ApiObject |
||
21 | { |
||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | const API_PREFIX = "users"; |
||
26 | |||
27 | /** |
||
28 | * The resource's URL. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $url; |
||
33 | |||
34 | /** |
||
35 | * The user's unique identifier. |
||
36 | * |
||
37 | * @var int |
||
38 | */ |
||
39 | protected $id; |
||
40 | |||
41 | /** |
||
42 | * The user's name. |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $name; |
||
47 | |||
48 | /** |
||
49 | * The user's email. |
||
50 | * |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $email; |
||
54 | |||
55 | /** |
||
56 | * The user's photo_url. |
||
57 | * |
||
58 | * @var string |
||
59 | */ |
||
60 | protected $photo_url; |
||
61 | |||
62 | /** |
||
63 | * The user's title. |
||
64 | * |
||
65 | * @var string |
||
66 | */ |
||
67 | protected $title; |
||
68 | |||
69 | /** |
||
70 | * The user's position. |
||
71 | * |
||
72 | * @var string |
||
73 | */ |
||
74 | protected $position; |
||
75 | |||
76 | /** |
||
77 | * The user's phone. |
||
78 | * |
||
79 | * @var string |
||
80 | */ |
||
81 | protected $phone; |
||
82 | |||
83 | /** |
||
84 | * The user's location. |
||
85 | * |
||
86 | * @var string |
||
87 | */ |
||
88 | protected $location; |
||
89 | |||
90 | /** |
||
91 | * The user's status. |
||
92 | * |
||
93 | * @var string |
||
94 | */ |
||
95 | protected $status; |
||
96 | |||
97 | /** |
||
98 | * The user's birthday. |
||
99 | * |
||
100 | * @var string |
||
101 | */ |
||
102 | protected $birthday; |
||
103 | |||
104 | /** |
||
105 | * True if the user is guest, false otherwise |
||
106 | * |
||
107 | * @var bool |
||
108 | */ |
||
109 | protected $is_guest; |
||
110 | |||
111 | /** |
||
112 | * The user's skills. |
||
113 | * |
||
114 | * @var string[] |
||
115 | */ |
||
116 | protected $skills; |
||
117 | |||
118 | /** |
||
119 | * Creation time. |
||
120 | * |
||
121 | * @var \DateTime |
||
122 | */ |
||
123 | protected $created_at; |
||
124 | |||
125 | /** |
||
126 | * Last update time. |
||
127 | * |
||
128 | * @var \DateTime |
||
129 | */ |
||
130 | protected $updated_at; |
||
131 | |||
132 | /** |
||
133 | * The membership type of this user with respect to a specific Pulse or PulseBoard. This value will not be set if |
||
134 | * a PulseUser object is created standalone and not by another object which supports subscribers or membership. |
||
135 | * |
||
136 | * @var mixed |
||
137 | */ |
||
138 | protected $membership; |
||
139 | |||
140 | /** |
||
141 | * The URL pattern used for all calls |
||
142 | * |
||
143 | * @var string |
||
144 | */ |
||
145 | private $urlSyntax = "%s/%s/%s.json"; |
||
146 | |||
147 | // ================================================================================================================ |
||
148 | // Getter functions |
||
149 | // ================================================================================================================ |
||
150 | |||
151 | /** |
||
152 | * The resource's URL. |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getUrl () |
||
157 | { |
||
158 | return $this->url; |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * The user's unique identifier. |
||
163 | * |
||
164 | * @return int |
||
165 | */ |
||
166 | 3 | public function getId () |
|
170 | |||
171 | /** |
||
172 | * The user's name. |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | public function getName () |
||
177 | { |
||
178 | return $this->name; |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * The user's email. |
||
183 | * |
||
184 | * @return string |
||
185 | */ |
||
186 | public function getEmail () |
||
187 | { |
||
188 | return $this->email; |
||
189 | } |
||
190 | |||
191 | /** |
||
192 | * The user's photo_url. |
||
193 | * |
||
194 | * @return string |
||
195 | */ |
||
196 | public function getPhotoUrl () |
||
197 | { |
||
198 | return $this->photo_url; |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * The user's title. |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | public function getTitle () |
||
207 | { |
||
208 | return $this->title; |
||
209 | } |
||
210 | |||
211 | /** |
||
212 | * The user's position. |
||
213 | * |
||
214 | * @return string |
||
215 | */ |
||
216 | public function getPosition () |
||
217 | { |
||
218 | return $this->position; |
||
219 | } |
||
220 | |||
221 | /** |
||
222 | * The user's phone. |
||
223 | * |
||
224 | * @return string |
||
225 | */ |
||
226 | public function getPhone () |
||
227 | { |
||
228 | return $this->phone; |
||
229 | } |
||
230 | |||
231 | /** |
||
232 | * The user's location. |
||
233 | * |
||
234 | * @return string |
||
235 | */ |
||
236 | public function getLocation () |
||
237 | { |
||
238 | return $this->location; |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * The user's status. |
||
243 | * |
||
244 | * @return string |
||
245 | */ |
||
246 | public function getStatus () |
||
247 | { |
||
248 | return $this->status; |
||
249 | } |
||
250 | |||
251 | /** |
||
252 | * The user's birthday. |
||
253 | * |
||
254 | * @return string |
||
255 | */ |
||
256 | public function getBirthday () |
||
257 | { |
||
258 | return $this->birthday; |
||
259 | } |
||
260 | |||
261 | /** |
||
262 | * True if the user is guest, false otherwise |
||
263 | * |
||
264 | * @return bool |
||
265 | */ |
||
266 | public function getIsGuest () |
||
267 | { |
||
268 | return $this->is_guest; |
||
269 | } |
||
270 | |||
271 | /** |
||
272 | * The user's skills. |
||
273 | * |
||
274 | * @return string[] |
||
275 | */ |
||
276 | public function getSkills () |
||
277 | { |
||
278 | return $this->skills; |
||
279 | } |
||
280 | |||
281 | /** |
||
282 | * Creation time. |
||
283 | * |
||
284 | * @return \DateTime |
||
285 | */ |
||
286 | public function getCreatedAt () |
||
287 | { |
||
288 | self::lazyCast($this->created_at, '\DateTime'); |
||
289 | |||
290 | return $this->created_at; |
||
291 | } |
||
292 | |||
293 | /** |
||
294 | * Last update time. |
||
295 | * |
||
296 | * @return \DateTime |
||
297 | */ |
||
298 | public function getUpdatedAt () |
||
299 | { |
||
300 | self::lazyCast($this->updated_at, '\DateTime'); |
||
301 | |||
302 | return $this->updated_at; |
||
303 | } |
||
304 | |||
305 | /** |
||
306 | * This function is now a placeholder until it can be removed since the DaPulse API no longer supports this |
||
307 | * functionality |
||
308 | * |
||
309 | * @api |
||
310 | * |
||
311 | * @deprecated 0.2.0 |
||
312 | * |
||
313 | * @since 0.1.0 |
||
314 | * |
||
315 | * @returns string An empty string |
||
316 | */ |
||
317 | public function getMembership () |
||
321 | |||
322 | /** |
||
323 | * Get the user's newsfeed |
||
324 | * |
||
325 | * @param array $params GET parameters that need to be passed in the URL |
||
326 | * |
||
327 | * @since 0.1.0 |
||
328 | * |
||
329 | * @return PulseUpdate[] An array of PulseUpdates that make up the user's newsfeed |
||
330 | */ |
||
331 | public function getNewsFeed ($params = array()) |
||
332 | { |
||
333 | $url = sprintf($this->urlSyntax, parent::apiEndpoint(), $this->id, "newsfeed"); |
||
|
|||
334 | |||
335 | return parent::fetchAndCastToObjectArray($url, "PulseUpdate", $params); |
||
337 | |||
338 | /** |
||
339 | * Get the user's posts |
||
340 | * |
||
341 | * @param array $params GET parameters that need to be passed in the URL |
||
342 | * |
||
343 | * @since 0.1.0 |
||
344 | * |
||
345 | * @return PulseUpdate[] An array of PulseUpdates for each of the posts |
||
346 | */ |
||
347 | public function getPosts ($params = array()) |
||
353 | |||
354 | /** |
||
355 | * Get the user's unread posts |
||
356 | * |
||
357 | * @param array $params GET parameters that need to be passed in the URL |
||
358 | * |
||
359 | * @since 0.1.0 |
||
360 | * |
||
361 | * @return PulseUpdate[] An array of PulseUpdates for each of the posts |
||
362 | */ |
||
363 | public function getUnreadFeed ($params = array()) |
||
369 | |||
370 | /** |
||
371 | * Get all of the users |
||
372 | * |
||
373 | * @param array $params GET parameters that need to be passed in the URL |
||
374 | * |
||
375 | * @since 0.1.0 |
||
376 | * |
||
377 | * @return PulseUser[] An array of PulseUsers for each of the users |
||
378 | */ |
||
379 | public static function getUsers ($params = array()) |
||
385 | } |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.