@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * @see https://developer.twitter.com/en/docs/basics/authentication/overview/oauth |
| 22 | 22 | */ |
| 23 | -class Twitter extends OAuth1Provider{ |
|
| 23 | +class Twitter extends OAuth1Provider { |
|
| 24 | 24 | |
| 25 | 25 | // choose your fighter |
| 26 | 26 | /** @see https://developer.twitter.com/en/docs/basics/authentication/api-reference/authorize */ |
| 27 | - protected string $authURL = 'https://api.twitter.com/oauth/authorize'; |
|
| 27 | + protected string $authURL = 'https://api.twitter.com/oauth/authorize'; |
|
| 28 | 28 | /** @see https://developer.twitter.com/en/docs/basics/authentication/api-reference/authenticate */ |
| 29 | 29 | # protected string $authURL = 'https://api.twitter.com/oauth/authenticate'; |
| 30 | 30 | |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | $response = $this->request('/1.1/account/verify_credentials.json'); |
| 43 | 43 | $status = $response->getStatusCode(); |
| 44 | 44 | |
| 45 | - if($status === 200){ |
|
| 45 | + if ($status === 200) { |
|
| 46 | 46 | return $response; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $json = MessageUtil::decodeJSON($response); |
| 50 | 50 | |
| 51 | - if(isset($json->errors, $json->errors[0]->message)){ |
|
| 51 | + if (isset($json->errors, $json->errors[0]->message)) { |
|
| 52 | 52 | throw new ProviderException($json->errors[0]->message); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -50,19 +50,19 @@ discard block |
||
| 50 | 50 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
| 51 | 51 | $data = json_decode(MessageUtil::decompress($response), true); |
| 52 | 52 | |
| 53 | - if(!is_array($data)){ |
|
| 53 | + if (!is_array($data)) { |
|
| 54 | 54 | throw new ProviderException('unable to parse token response'); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if(isset($data['error'])){ |
|
| 58 | - throw new ProviderException(sprintf('error retrieving access token: "%s"', $data['error'])); |
|
| 57 | + if (isset($data['error'])) { |
|
| 58 | + throw new ProviderException(sprintf('error retrieving access token: "%s"', $data['error'])); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // @codeCoverageIgnoreStart |
| 62 | - if(isset($data['name'], $data['message'])){ |
|
| 62 | + if (isset($data['name'], $data['message'])) { |
|
| 63 | 63 | $msg = sprintf('error retrieving access token: "%s" [%s]', $data['message'], $data['name']); |
| 64 | 64 | |
| 65 | - if(isset($data['links']) && is_array($data['links'])){ |
|
| 65 | + if (isset($data['links']) && is_array($data['links'])) { |
|
| 66 | 66 | $msg .= "\n".implode("\n", array_column($data['links'], 'href')); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | // @codeCoverageIgnoreEnd |
| 72 | 72 | |
| 73 | - if(!isset($data['access_token'])){ |
|
| 73 | + if (!isset($data['access_token'])) { |
|
| 74 | 74 | throw new ProviderException('token missing'); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | $response = $this->request('/v1/identity/oauth2/userinfo', ['schema' => 'paypalv1.1']); |
| 122 | 122 | $status = $response->getStatusCode(); |
| 123 | 123 | |
| 124 | - if($status === 200){ |
|
| 124 | + if ($status === 200) { |
|
| 125 | 125 | return $response; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $json = MessageUtil::decodeJSON($response); |
| 129 | 129 | |
| 130 | - if(isset($json->error, $json->error_description)){ |
|
| 130 | + if (isset($json->error, $json->error_description)) { |
|
| 131 | 131 | throw new ProviderException($json->error_description); |
| 132 | 132 | } |
| 133 | 133 | |