1 | <?php |
||
14 | class Authenticator |
||
15 | { |
||
16 | /** |
||
17 | * The Application ID. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $appId; |
||
22 | |||
23 | /** |
||
24 | * The Application App Secret. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $appSecret; |
||
29 | |||
30 | /** |
||
31 | * A CSRF state variable to assist in the defense against CSRF attacks. |
||
32 | */ |
||
33 | protected $state; |
||
34 | |||
35 | /** |
||
36 | * @var DataStorageInterface storage |
||
37 | */ |
||
38 | private $storage; |
||
39 | |||
40 | /** |
||
41 | * @var RequestManager |
||
42 | */ |
||
43 | private $requestManager; |
||
44 | |||
45 | /** |
||
46 | * @param RequestManager $requestManager |
||
47 | * @param string $appId |
||
48 | * @param string $appSecret |
||
49 | */ |
||
50 | public function __construct(RequestManager $requestManager, $appId, $appSecret) |
||
56 | |||
57 | /** |
||
58 | * Determines and returns the user access token using the authorization code. The intent is to |
||
59 | * return a valid access token, or null if one is determined to not be available. |
||
60 | * |
||
61 | * @param UrlGeneratorInterface $urlGenerator |
||
62 | * |
||
63 | * @return AccessToken|null A valid user access token, or null if one could not be determined. |
||
64 | * |
||
65 | * @throws LinkedInTransferException |
||
66 | */ |
||
67 | public function fetchNewAccessToken(UrlGeneratorInterface $urlGenerator) |
||
93 | |||
94 | /** |
||
95 | * Retrieves an access token for the given authorization code |
||
96 | * (previously generated from www.linkedin.com on behalf of |
||
97 | * a specific user). The authorization code is sent to www.linkedin.com |
||
98 | * and a legitimate access token is generated provided the access token |
||
99 | * and the user for which it was generated all match, and the user is |
||
100 | * either logged in to LinkedIn or has granted an offline access permission. |
||
101 | * |
||
102 | * @param UrlGeneratorInterface $urlGenerator |
||
103 | * @param string $code An authorization code. |
||
104 | * |
||
105 | * @return AccessToken An access token exchanged for the authorization code. |
||
106 | */ |
||
107 | protected function getAccessTokenFromCode(UrlGeneratorInterface $urlGenerator, $code) |
||
147 | |||
148 | /** |
||
149 | * Get a Login URL for use with redirects. By default, full page redirect is |
||
150 | * assumed. If you are using the generated URL with a window.open() call in |
||
151 | * JavaScript, you can pass in display=popup as part of the $params. |
||
152 | * |
||
153 | * The parameters: |
||
154 | * - redirect_uri: the url to go to after a successful login |
||
155 | * - scope: comma (or space) separated list of requested extended permissions |
||
156 | * |
||
157 | * @param UrlGeneratorInterface $urlGenerator |
||
158 | * @param array $options Provide custom parameters |
||
159 | * |
||
160 | * @return string The URL for the login flow |
||
161 | */ |
||
162 | public function getLoginUrl(UrlGeneratorInterface $urlGenerator, $options = array()) |
||
198 | |||
199 | /** |
||
200 | * Get the authorization code from the query parameters, if it exists, |
||
201 | * and otherwise return null to signal no authorization code was |
||
202 | * discoverable. |
||
203 | * |
||
204 | * @return string|null The authorization code, or null if the authorization code could not be determined. |
||
205 | * |
||
206 | * @throws LinkedInTransferException |
||
207 | */ |
||
208 | protected function getCode() |
||
242 | |||
243 | /** |
||
244 | * Lays down a CSRF state token for this process. |
||
245 | */ |
||
246 | protected function establishCSRFTokenState() |
||
253 | |||
254 | /** |
||
255 | * Clear the storage. |
||
256 | * |
||
257 | * @return $this |
||
258 | */ |
||
259 | public function clearStorage() |
||
265 | |||
266 | /** |
||
267 | * Get the state, use this to verify the CSRF token. |
||
268 | * |
||
269 | * |
||
270 | * @return string|null |
||
271 | */ |
||
272 | protected function getState() |
||
280 | |||
281 | /** |
||
282 | * @param $state |
||
283 | * |
||
284 | * @return $this |
||
285 | */ |
||
286 | protected function setState($state) |
||
292 | |||
293 | /** |
||
294 | * @return DataStorageInterface |
||
295 | */ |
||
296 | protected function getStorage() |
||
304 | |||
305 | /** |
||
306 | * @param DataStorageInterface $storage |
||
307 | * |
||
308 | * @return $this |
||
309 | */ |
||
310 | public function setStorage(DataStorageInterface $storage) |
||
316 | |||
317 | /** |
||
318 | * @return RequestManager |
||
319 | */ |
||
320 | protected function getRequestManager() |
||
324 | } |
||
325 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: