-
Notifications
You must be signed in to change notification settings - Fork 13
/
ExtractorInterface.php
280 lines (243 loc) · 5.69 KB
/
ExtractorInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<?php
/*
* This file is part of the php-oauth package <https://github.com/logical-and/php-oauth>.
*
* (c) Oryzone, developed by Luciano Mammino <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace OAuth\UserData\Extractor;
use OAuth\UserData\Exception\Exception;
/**
* Interface ExtractorInterface
*
* @package OAuth\UserData\Extractor
*/
interface ExtractorInterface
{
/**
* Field names constants
*/
const FIELD_UNIQUE_ID = 'uniqueId';
const FIELD_USERNAME = 'username';
const FIELD_FIRST_NAME = 'firstName';
const FIELD_LAST_NAME = 'lastName';
const FIELD_FULL_NAME = 'fullName';
const FIELD_EMAIL = 'email';
const FIELD_LOCATION = 'location';
const FIELD_DESCRIPTION = 'description';
const FIELD_IMAGE_URL = 'imageUrl';
const FIELD_PROFILE_URL = 'profileUrl';
const FIELD_WEBSITES = 'websites';
const FIELD_VERIFIED_EMAIL = 'verifiedEmail';
const FIELD_EXTRA = 'extra';
/**
* @param \OAuth\Common\Service\ServiceInterface $service
*
* @return void
*/
public function setService($service);
/**
* Get oauth service
*
* @param bool $throw Will throw an exception if no service was set
*
* @throws Exception If not service was set
*
* @return \OAuth\OAuth1\Service\AbstractService|\OAuth\OAuth2\Service\AbstractService
*/
public function getService($throw = true);
/**
* Get service id
*
* @return string String, like "google" or "facebook"
* @throws Exception
*/
public function getServiceId();
/**
* Check if the current provider supports a unique id
*
* @return bool
*/
public function supportsUniqueId();
/**
* Get the unique id of the user
*
* @return string
*/
public function getUniqueId();
/**
* Check if the current provider supports a username
*
* @return bool
*/
public function supportsUsername();
/**
* Get the username
*
* @return string
*/
public function getUsername();
/**
* Check if the current provider supports a first name
*
* @return bool
*/
public function supportsFirstName();
/**
* Get the first name
*
* @return string
*/
public function getFirstName();
/**
* Check if the current provider supports a last name
*
* @return bool
*/
public function supportsLastName();
/**
* Get the last name
*
* @return string
*/
public function getLastName();
/**
* Check if the current provider supports a full name
*
* @return bool
*/
public function supportsFullName();
/**
* Get the full name
*
* @return string
*/
public function getFullName();
/**
* Check ig the current provider supports an email
*
* @return bool
*/
public function supportsEmail();
/**
* Get the email
*
* @return string
*/
public function getEmail();
/**
* Check if the current provider supports a location
*
* @return bool
*/
public function supportsLocation();
/**
* Get the location
*
* @return string
*/
public function getLocation();
/**
* Check if the current provider supports a description
*
* @return bool
*/
public function supportsDescription();
/**
* Get the description
*
* @return string
*/
public function getDescription();
/**
* Check if the current provider supports an image url
*
* @return bool
*/
public function supportsImageUrl();
/**
* Get the image url
*
* @return string
*/
public function getImageUrl();
/**
* Check if the current provider supports a profile url
*
* @return bool
*/
public function supportsProfileUrl();
/**
* Get the profile url
*
* @return string
*/
public function getProfileUrl();
/**
* Check if the current provider supports websites
*
* @return bool
*/
public function supportsWebsites();
/**
* Get websites
*
* @return array
*/
public function getWebsites();
/**
* Check if the current provider supports the "verified" field
*
* @return bool
*/
public function supportsVerifiedEmail();
/**
* Get the verified
*
* @return bool
*/
public function isEmailVerified();
/**
* Check if the current provider supports extra data
*
* @return bool
*/
public function supportsExtra();
/**
* Get an extra attribute
*
* @param string $key
*
* @return array
*/
public function getExtra($key);
/**
* Get the extras array
*
* @return array
*/
public function getExtras();
/**
* Save image file by given path. Path extension is mandatory and it's determine, which image type will be used
*
* @param $savePath
* @param bool $width Optional value, max width
* @param bool $height Optional value, max height
*
* @return bool|string File path if success, false if failure
* @throws Exception
*/
public function saveImage($savePath, $width = false, $height = false);
/**
* Get image raw data
*
* @param bool $width Optional value, max width
* @param bool $height Optional value, max height
*
* @return bool|mixed|string
* @throws Exception
*/
public function getImageRawData($width = false, $height = false);
}