|
2 | 2 |
|
3 | 3 | namespace OAuth\OAuth2\Service; |
4 | 4 |
|
5 | | -use OAuth\OAuth2\Token\StdOAuth2Token; |
6 | | -use OAuth\Common\Http\Exception\TokenResponseException; |
7 | | -use OAuth\Common\Http\Uri\Uri; |
8 | 5 | use OAuth\Common\Consumer\CredentialsInterface; |
9 | 6 | use OAuth\Common\Http\Client\ClientInterface; |
10 | | -use OAuth\Common\Storage\TokenStorageInterface; |
| 7 | +use OAuth\Common\Http\Exception\TokenResponseException; |
| 8 | +use OAuth\Common\Http\Uri\Uri; |
11 | 9 | use OAuth\Common\Http\Uri\UriInterface; |
| 10 | +use OAuth\Common\Storage\TokenStorageInterface; |
| 11 | +use OAuth\OAuth2\Token\StdOAuth2Token; |
12 | 12 |
|
13 | 13 | /** |
14 | 14 | * Linkedin service. |
15 | 15 | * |
16 | 16 | * @author Antoine Corcy <contact@sbin.dk> |
17 | | - * @link http://developer.linkedin.com/documents/authentication |
| 17 | + * |
| 18 | + * @see http://developer.linkedin.com/documents/authentication |
18 | 19 | */ |
19 | 20 | class Linkedin extends AbstractService |
20 | 21 | { |
21 | 22 | /** |
22 | | - * Defined scopes |
| 23 | + * Defined scopes. |
23 | 24 | * |
24 | | - * @link https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context |
| 25 | + * @see https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context |
25 | 26 | */ |
26 | | - const SCOPE_R_LITEPROFILE = 'r_liteprofile'; |
27 | | - const SCOPE_R_FULLPROFILE = 'r_fullprofile'; |
28 | | - const SCOPE_R_EMAILADDRESS = 'r_emailaddress'; |
29 | | - const SCOPE_R_NETWORK = 'r_network'; |
30 | | - const SCOPE_R_CONTACTINFO = 'r_contactinfo'; |
31 | | - const SCOPE_RW_NUS = 'rw_nus'; |
32 | | - const SCOPE_RW_COMPANY_ADMIN = 'rw_company_admin'; |
33 | | - const SCOPE_RW_GROUPS = 'rw_groups'; |
34 | | - const SCOPE_W_MESSAGES = 'w_messages'; |
35 | | - const SCOPE_W_MEMBER_SOCIAL = 'w_member_social'; |
| 27 | + const SCOPE_R_LITEPROFILE = 'r_liteprofile'; |
| 28 | + const SCOPE_R_FULLPROFILE = 'r_fullprofile'; |
| 29 | + const SCOPE_R_EMAILADDRESS = 'r_emailaddress'; |
| 30 | + const SCOPE_R_NETWORK = 'r_network'; |
| 31 | + const SCOPE_R_CONTACTINFO = 'r_contactinfo'; |
| 32 | + const SCOPE_RW_NUS = 'rw_nus'; |
| 33 | + const SCOPE_RW_COMPANY_ADMIN = 'rw_company_admin'; |
| 34 | + const SCOPE_RW_GROUPS = 'rw_groups'; |
| 35 | + const SCOPE_W_MESSAGES = 'w_messages'; |
| 36 | + const SCOPE_W_MEMBER_SOCIAL = 'w_member_social'; |
36 | 37 |
|
37 | 38 | public function __construct( |
38 | 39 | CredentialsInterface $credentials, |
39 | 40 | ClientInterface $httpClient, |
40 | 41 | TokenStorageInterface $storage, |
41 | | - $scopes = array(), |
42 | | - UriInterface $baseApiUri = null |
| 42 | + $scopes = [], |
| 43 | + ?UriInterface $baseApiUri = null |
43 | 44 | ) { |
44 | 45 | if (count($scopes) === 0) { |
45 | | - $scopes = array(self::SCOPE_R_LITEPROFILE, self::SCOPE_R_EMAILADDRESS); |
| 46 | + $scopes = [self::SCOPE_R_LITEPROFILE, self::SCOPE_R_EMAILADDRESS]; |
46 | 47 | } |
47 | 48 |
|
48 | 49 | parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); |
@@ -98,8 +99,7 @@ protected function parseAccessTokenResponse($responseBody) |
98 | 99 | unset($data['refresh_token']); |
99 | 100 | } |
100 | 101 |
|
101 | | - unset($data['access_token']); |
102 | | - unset($data['expires_in']); |
| 102 | + unset($data['access_token'], $data['expires_in']); |
103 | 103 |
|
104 | 104 | $token->setExtraParams($data); |
105 | 105 |
|
|
0 commit comments