1 | <?php |
||
23 | class ORCID extends AbstractProvider |
||
24 | { |
||
25 | use BearerAuthorizationTrait; |
||
26 | |||
27 | /** |
||
28 | * @var string Key used in the access token response to identify the resource owner. |
||
29 | */ |
||
30 | const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'orcid'; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | public $sandbox = false; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | public $member = false; |
||
41 | |||
42 | /** |
||
43 | * Returns the base URL for authorizing a client. |
||
44 | * |
||
45 | * @return string |
||
46 | */ |
||
47 | public function getBaseAuthorizationUrl() |
||
53 | |||
54 | /** |
||
55 | * Returns the base URL for requesting an access token. |
||
56 | * |
||
57 | * @param array $params |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getBaseAccessTokenUrl(array $params) |
||
66 | |||
67 | /** |
||
68 | * Returns the URL for requesting the resource owner's details. |
||
69 | * |
||
70 | * @param AccessToken $token |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
||
83 | |||
84 | /** |
||
85 | * Returns the default scopes used by this provider. |
||
86 | * |
||
87 | * This should only be the scopes that are required to request the details |
||
88 | * of the resource owner, rather than all the available scopes. |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | protected function getDefaultScopes() |
||
96 | |||
97 | /** |
||
98 | * Returns the string that should be used to separate scopes when building |
||
99 | * the URL for requesting an access token. |
||
100 | * |
||
101 | * @return string Scope separator, defaults to ',' |
||
102 | */ |
||
103 | protected function getScopeSeparator() |
||
107 | |||
108 | /** |
||
109 | * Returns the default headers used by this provider. |
||
110 | * |
||
111 | * Typically this is used to set 'Accept' or 'Content-Type' headers. |
||
112 | * |
||
113 | * @return array |
||
114 | */ |
||
115 | protected function getDefaultHeaders() |
||
119 | |||
120 | |||
121 | /** |
||
122 | * Check a provider response for errors. |
||
123 | * |
||
124 | * @throws IdentityProviderException |
||
125 | * @param ResponseInterface $response |
||
126 | * @param string $data Parsed response data |
||
127 | * @return void |
||
128 | */ |
||
129 | protected function checkResponse(ResponseInterface $response, $data) |
||
157 | |||
158 | /** |
||
159 | * Generate a user object from a successful user details request. |
||
160 | * |
||
161 | * @param object $response |
||
162 | * @param AccessToken $token |
||
163 | * @return ORCIDResourceOwner |
||
164 | */ |
||
165 | protected function createResourceOwner(array $response, AccessToken $token) |
||
169 | |||
170 | /** |
||
171 | * Returns a prepared request for requesting an access token. |
||
172 | * |
||
173 | * @param array $params Query string parameters |
||
174 | * @return RequestInterface |
||
175 | */ |
||
176 | protected function getAccessTokenRequest(array $params, $accesstoken = null) |
||
187 | /** |
||
188 | * Requests an access token using a specified grant and option set. |
||
189 | * |
||
190 | * @param mixed $grant |
||
191 | * @param array $options |
||
192 | * @return AccessToken |
||
193 | */ |
||
194 | public function getAccessToken($grant, array $options = [], $accesstoken = null) |
||
209 | } |
||
210 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.