1 | <?php |
||
33 | class LinkedIn implements LinkedInInterface |
||
34 | { |
||
35 | /** |
||
36 | * The OAuth access token received in exchange for a valid authorization |
||
37 | * code. null means the access token has yet to be determined. |
||
38 | * |
||
39 | * @var AccessToken |
||
40 | */ |
||
41 | protected $accessToken = null; |
||
42 | |||
43 | /** |
||
44 | * @var string format |
||
45 | */ |
||
46 | private $format; |
||
47 | |||
48 | /** |
||
49 | * @var string responseFormat |
||
50 | */ |
||
51 | private $responseDataType; |
||
52 | |||
53 | /** |
||
54 | * @var ResponseInterface |
||
55 | */ |
||
56 | private $lastResponse; |
||
57 | |||
58 | /** |
||
59 | * @var RequestManager |
||
60 | */ |
||
61 | private $requestManager; |
||
62 | |||
63 | /** |
||
64 | * @var Authenticator |
||
65 | */ |
||
66 | private $authenticator; |
||
67 | |||
68 | /** |
||
69 | * @var UrlGeneratorInterface |
||
70 | */ |
||
71 | private $urlGenerator; |
||
72 | |||
73 | /** |
||
74 | * Constructor. |
||
75 | * |
||
76 | * @param string $appId |
||
77 | * @param string $appSecret |
||
78 | * @param string $format 'json', 'xml' |
||
79 | * @param string $responseDataType 'array', 'string', 'simple_xml' 'psr7', 'stream' |
||
80 | */ |
||
81 | 7 | public function __construct($appId, $appSecret, $format = 'json', $responseDataType = 'array') |
|
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | 1 | public function isAuthenticated() |
|
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | 1 | public function api($method, $resource, array $options = []) |
|
135 | |||
136 | /** |
||
137 | * Modify and filter the request options. Make sure we use the correct query parameters and headers. |
||
138 | * |
||
139 | * @param array &$options |
||
140 | * |
||
141 | * @return string the request format to use |
||
142 | */ |
||
143 | 1 | protected function filterRequestOption(array &$options) |
|
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | 2 | public function getLoginUrl($options = []) |
|
184 | |||
185 | /** |
||
186 | * See docs for LinkedIn::api(). |
||
187 | * |
||
188 | * @param string $resource |
||
189 | * @param array $options |
||
190 | * |
||
191 | * @return mixed |
||
192 | */ |
||
193 | public function get($resource, array $options = []) |
||
197 | |||
198 | /** |
||
199 | * See docs for LinkedIn::api(). |
||
200 | * |
||
201 | * @param string $resource |
||
202 | * @param array $options |
||
203 | * |
||
204 | * @return mixed |
||
205 | */ |
||
206 | public function post($resource, array $options = []) |
||
210 | |||
211 | /** |
||
212 | * {@inheritdoc} |
||
213 | */ |
||
214 | public function clearStorage() |
||
220 | |||
221 | /** |
||
222 | * {@inheritdoc} |
||
223 | */ |
||
224 | 3 | public function hasError() |
|
228 | |||
229 | /** |
||
230 | * {@inheritdoc} |
||
231 | */ |
||
232 | 2 | public function getError() |
|
238 | |||
239 | /** |
||
240 | * Get the default format to use when sending requests. |
||
241 | * |
||
242 | * @return string |
||
243 | */ |
||
244 | 1 | protected function getFormat() |
|
248 | |||
249 | /** |
||
250 | * {@inheritdoc} |
||
251 | */ |
||
252 | 1 | public function setFormat($format) |
|
258 | |||
259 | /** |
||
260 | * Get the default data type to be returned as a response. |
||
261 | * |
||
262 | * @return string |
||
263 | */ |
||
264 | 1 | protected function getResponseDataType() |
|
268 | |||
269 | /** |
||
270 | * {@inheritdoc} |
||
271 | */ |
||
272 | public function setResponseDataType($responseDataType) |
||
278 | |||
279 | /** |
||
280 | * {@inheritdoc} |
||
281 | */ |
||
282 | public function getLastResponse() |
||
286 | |||
287 | /** |
||
288 | * {@inheritdoc} |
||
289 | */ |
||
290 | 1 | public function getAccessToken() |
|
301 | |||
302 | /** |
||
303 | * {@inheritdoc} |
||
304 | */ |
||
305 | 1 | public function setAccessToken($accessToken) |
|
315 | |||
316 | /** |
||
317 | * {@inheritdoc} |
||
318 | */ |
||
319 | 1 | public function setUrlGenerator(UrlGeneratorInterface $urlGenerator) |
|
325 | |||
326 | /** |
||
327 | * @return UrlGeneratorInterface |
||
328 | */ |
||
329 | 2 | protected function getUrlGenerator() |
|
337 | |||
338 | /** |
||
339 | * {@inheritdoc} |
||
340 | */ |
||
341 | public function setStorage(DataStorageInterface $storage) |
||
347 | |||
348 | /** |
||
349 | * {@inheritdoc} |
||
350 | */ |
||
351 | public function setHttpClient(HttpClient $client) |
||
357 | |||
358 | /** |
||
359 | * {@inheritdoc} |
||
360 | */ |
||
361 | public function setHttpMessageFactory(MessageFactory $factory) |
||
367 | |||
368 | /** |
||
369 | * @return RequestManager |
||
370 | */ |
||
371 | protected function getRequestManager() |
||
375 | |||
376 | /** |
||
377 | * @return Authenticator |
||
378 | */ |
||
379 | protected function getAuthenticator() |
||
383 | } |
||
384 |