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