|
1
|
|
|
<?php |
|
2
|
|
|
namespace CrewLabs\OAuth2\Client\Provider; |
|
3
|
|
|
|
|
4
|
|
|
use League\OAuth2\Client\Provider\ResourceOwnerInterface; |
|
5
|
|
|
use League\OAuth2\Client\Tool\ArrayAccessorTrait; |
|
6
|
|
|
|
|
7
|
|
|
class DribbbleResourceOwner implements ResourceOwnerInterface |
|
8
|
|
|
{ |
|
9
|
|
|
use ArrayAccessorTrait; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Raw response |
|
13
|
|
|
* |
|
14
|
|
|
* @var |
|
15
|
|
|
*/ |
|
16
|
|
|
protected $response; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Creates new resource owner. |
|
20
|
|
|
* |
|
21
|
|
|
* @param $response |
|
22
|
|
|
*/ |
|
23
|
3 |
|
public function __construct($response) |
|
24
|
|
|
{ |
|
25
|
3 |
|
$this->response = $response; |
|
26
|
3 |
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Get resource owner id |
|
30
|
|
|
* |
|
31
|
|
|
* @return string|null |
|
32
|
|
|
*/ |
|
33
|
3 |
|
public function getId() |
|
34
|
|
|
{ |
|
35
|
3 |
|
return $this->getValueByKey($this->response, 'id'); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Return all of the details available as an array. |
|
40
|
|
|
* |
|
41
|
|
|
* @return array |
|
42
|
|
|
*/ |
|
43
|
3 |
|
public function toArray() |
|
44
|
|
|
{ |
|
45
|
3 |
|
return $this->response; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get resource owner name |
|
50
|
|
|
* @return string |
|
51
|
|
|
*/ |
|
52
|
3 |
|
public function getName() |
|
53
|
|
|
{ |
|
54
|
3 |
|
return $this->getValueByKey($this->response, 'name'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Get resource owner username |
|
59
|
|
|
* @return string |
|
60
|
|
|
*/ |
|
61
|
3 |
|
public function getUsername() |
|
62
|
|
|
{ |
|
63
|
3 |
|
return $this->getValueByKey($this->response, 'username'); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Get resource owner html url |
|
68
|
|
|
* @return string |
|
69
|
|
|
*/ |
|
70
|
3 |
|
public function getHtmlUrl() |
|
71
|
|
|
{ |
|
72
|
3 |
|
return $this->getValueByKey($this->response, 'html_url'); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Get resource owner avatar url |
|
77
|
|
|
* @return string |
|
78
|
|
|
*/ |
|
79
|
3 |
|
public function getAvatarUrl() |
|
80
|
|
|
{ |
|
81
|
3 |
|
return $this->getValueByKey($this->response, 'avatar_url'); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Get resource owner bio |
|
86
|
|
|
* @return string |
|
87
|
|
|
*/ |
|
88
|
3 |
|
public function getBio() |
|
89
|
|
|
{ |
|
90
|
3 |
|
return $this->getValueByKey($this->response, 'bio'); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Get resource owner location |
|
95
|
|
|
* @return string |
|
96
|
|
|
*/ |
|
97
|
3 |
|
public function getLocation() |
|
98
|
|
|
{ |
|
99
|
3 |
|
return $this->getValueByKey($this->response, 'location'); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Get resource owner links |
|
104
|
|
|
* @return array |
|
105
|
|
|
*/ |
|
106
|
3 |
|
public function getLinks() |
|
107
|
|
|
{ |
|
108
|
3 |
|
return $this->getValueByKey($this->response, 'links'); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Get resource bucket count |
|
113
|
|
|
* @return int |
|
114
|
|
|
*/ |
|
115
|
3 |
|
public function getBucketCount() |
|
116
|
|
|
{ |
|
117
|
3 |
|
return $this->getValueByKey($this->response, 'buckets_count'); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Get resource comments received count |
|
122
|
|
|
* @return int |
|
123
|
|
|
*/ |
|
124
|
3 |
|
public function getCommentsReceivedCount() |
|
125
|
|
|
{ |
|
126
|
3 |
|
return $this->getValueByKey($this->response, 'comments_received_count'); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Get resource followers count |
|
131
|
|
|
* @return int |
|
132
|
|
|
*/ |
|
133
|
3 |
|
public function getFollowersCount() |
|
134
|
|
|
{ |
|
135
|
3 |
|
return $this->getValueByKey($this->response, 'followers_count'); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* Get resource followings count |
|
140
|
|
|
* @return int |
|
141
|
|
|
*/ |
|
142
|
3 |
|
public function getFollowingsCount() |
|
143
|
|
|
{ |
|
144
|
3 |
|
return $this->getValueByKey($this->response, 'followings_count'); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* Get resource likes count |
|
149
|
|
|
* @return int |
|
150
|
|
|
*/ |
|
151
|
3 |
|
public function getLikesCount() |
|
152
|
|
|
{ |
|
153
|
3 |
|
return $this->getValueByKey($this->response, 'likes_count'); |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* Get resource likes received count |
|
158
|
|
|
* @return int |
|
159
|
|
|
*/ |
|
160
|
3 |
|
public function getLikesReceivedCount() |
|
161
|
|
|
{ |
|
162
|
3 |
|
return $this->getValueByKey($this->response, 'likes_received_count'); |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Get resource projects count |
|
167
|
|
|
* @return int |
|
168
|
|
|
*/ |
|
169
|
3 |
|
public function getProjectsCount() |
|
170
|
|
|
{ |
|
171
|
3 |
|
return $this->getValueByKey($this->response, 'projects_count'); |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* Get resource rebounds count |
|
176
|
|
|
* @return int |
|
177
|
|
|
*/ |
|
178
|
3 |
|
public function getReboundsReceivedCount() |
|
179
|
|
|
{ |
|
180
|
3 |
|
return $this->getValueByKey($this->response, 'rebounds_received_count'); |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* Get resource shots count |
|
185
|
|
|
* @return int |
|
186
|
|
|
*/ |
|
187
|
3 |
|
public function getShotsCount() |
|
188
|
|
|
{ |
|
189
|
3 |
|
return $this->getValueByKey($this->response, 'shots_count'); |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* Get resource teams count |
|
194
|
|
|
* @return int |
|
195
|
|
|
*/ |
|
196
|
3 |
|
public function getTeamsCount() |
|
197
|
|
|
{ |
|
198
|
3 |
|
return $this->getValueByKey($this->response, 'teams_count'); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* Can resource owner upload shots |
|
203
|
|
|
* @return bool |
|
204
|
|
|
*/ |
|
205
|
3 |
|
public function canUploadShot() |
|
206
|
|
|
{ |
|
207
|
3 |
|
return ($this->getValueByKey($this->response, 'can_upload_shot') == 'true'); |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* can resource owner type |
|
212
|
|
|
* @return string |
|
213
|
|
|
*/ |
|
214
|
3 |
|
public function getType() |
|
215
|
|
|
{ |
|
216
|
3 |
|
return $this->getValueByKey($this->response, 'type'); |
|
217
|
|
|
} |
|
218
|
|
|
|
|
219
|
|
|
/** |
|
220
|
|
|
* Is resource owner a Pro account |
|
221
|
|
|
* @return bool |
|
222
|
|
|
*/ |
|
223
|
3 |
|
public function isPro() |
|
224
|
|
|
{ |
|
225
|
3 |
|
return ($this->getValueByKey($this->response, 'pro') == 'true'); |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
/** |
|
229
|
|
|
* Get resource owner buckets url |
|
230
|
|
|
* @return string |
|
231
|
|
|
*/ |
|
232
|
3 |
|
public function getBucketsUrl() |
|
233
|
|
|
{ |
|
234
|
3 |
|
return $this->getValueByKey($this->response, 'buckets_url'); |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* Get resource owner followers url |
|
239
|
|
|
* @return string |
|
240
|
|
|
*/ |
|
241
|
3 |
|
public function getFollowersUrl() |
|
242
|
|
|
{ |
|
243
|
3 |
|
return $this->getValueByKey($this->response, 'followers_url'); |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
/** |
|
247
|
|
|
* Get resource owners following url |
|
248
|
|
|
* @return string |
|
249
|
|
|
*/ |
|
250
|
3 |
|
public function getFollowingUrl() |
|
251
|
|
|
{ |
|
252
|
3 |
|
return $this->getValueByKey($this->response, 'following_url'); |
|
253
|
|
|
} |
|
254
|
|
|
|
|
255
|
|
|
/** |
|
256
|
|
|
* Get resource owners likes url |
|
257
|
|
|
* @return string |
|
258
|
|
|
*/ |
|
259
|
3 |
|
public function getLikesUrl() |
|
260
|
|
|
{ |
|
261
|
3 |
|
return $this->getValueByKey($this->response, 'likes_url'); |
|
262
|
|
|
} |
|
263
|
|
|
|
|
264
|
|
|
/** |
|
265
|
|
|
* Get resource owner projects url |
|
266
|
|
|
* @return string |
|
267
|
|
|
*/ |
|
268
|
3 |
|
public function getProjectsUrl() |
|
269
|
|
|
{ |
|
270
|
3 |
|
return $this->getValueByKey($this->response, 'projects_url'); |
|
271
|
|
|
} |
|
272
|
|
|
|
|
273
|
|
|
/** |
|
274
|
|
|
* Get resource owner shots url |
|
275
|
|
|
* @return string |
|
276
|
|
|
*/ |
|
277
|
3 |
|
public function getShotsUrl() |
|
278
|
|
|
{ |
|
279
|
3 |
|
return $this->getValueByKey($this->response, 'shots_url'); |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
/** |
|
283
|
|
|
* Get resource owner teams url |
|
284
|
|
|
* @return string |
|
285
|
|
|
*/ |
|
286
|
3 |
|
public function getTeamsUrl() |
|
287
|
|
|
{ |
|
288
|
3 |
|
return $this->getValueByKey($this->response, 'teams_url'); |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* Get resource created date |
|
293
|
|
|
* @return string |
|
294
|
|
|
*/ |
|
295
|
3 |
|
public function getCreated() |
|
296
|
|
|
{ |
|
297
|
3 |
|
return $this->getValueByKey($this->response, 'created_at'); |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
/** |
|
301
|
|
|
* Get resource updated date |
|
302
|
|
|
* @return string |
|
303
|
|
|
*/ |
|
304
|
3 |
|
public function getUpdated() |
|
305
|
|
|
{ |
|
306
|
3 |
|
return $this->getValueByKey($this->response, 'updated_at'); |
|
307
|
|
|
} |
|
308
|
|
|
} |
|
309
|
|
|
|