@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @link https://developer.paypal.com/docs/api/identity/v1/ |
19 | 19 | */ |
20 | -class PayPalEndpoints extends EndpointMap{ |
|
20 | +class PayPalEndpoints extends EndpointMap { |
|
21 | 21 | |
22 | 22 | protected $me = [ |
23 | 23 | 'path' => '/v1/identity/oauth2/userinfo', |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | protected function parseTokenResponse(ResponseInterface $response):AccessToken{ |
45 | 45 | $data = \json_decode(Psr7\decompress_content($response), true); |
46 | 46 | |
47 | - if(!\is_array($data)){ |
|
47 | + if (!\is_array($data)) { |
|
48 | 48 | throw new ProviderException('unable to parse token response'); |
49 | 49 | } |
50 | 50 | |
51 | - foreach(['error_description', 'error'] as $field){ |
|
52 | - if(isset($data[$field])){ |
|
51 | + foreach (['error_description', 'error'] as $field) { |
|
52 | + if (isset($data[$field])) { |
|
53 | 53 | throw new ProviderException('error retrieving access token: "'.$data[$field].'"'); |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | 57 | // @codeCoverageIgnoreStart |
58 | - if(isset($data['name'], $data['message'])){ |
|
58 | + if (isset($data['name'], $data['message'])) { |
|
59 | 59 | $msg = \sprintf('error retrieving access token: "%s" [%s]', $data['message'], $data['name']); |
60 | 60 | |
61 | - if(isset($data['links']) && \is_array($data['links'])){ |
|
61 | + if (isset($data['links']) && \is_array($data['links'])) { |
|
62 | 62 | $msg .= "\n".\implode("\n", \array_column($data['links'], 'href')); |
63 | 63 | } |
64 | 64 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | // @codeCoverageIgnoreEnd |
68 | 68 | |
69 | - if(!isset($data['access_token'])){ |
|
69 | + if (!isset($data['access_token'])) { |
|
70 | 70 | throw new ProviderException('token missing'); |
71 | 71 | } |
72 | 72 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getAccessToken(string $code, string $state = null):AccessToken{ |
94 | 94 | |
95 | - if($this instanceof CSRFToken){ |
|
95 | + if ($this instanceof CSRFToken) { |
|
96 | 96 | $this->checkState($state); |
97 | 97 | } |
98 | 98 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\OAuth\Providers\PayPal; |
14 | 14 | |
15 | -class PayPalSandbox extends PayPal{ |
|
15 | +class PayPalSandbox extends PayPal { |
|
16 | 16 | |
17 | 17 | protected $apiURL = 'https://api.sandbox.paypal.com'; |
18 | 18 | protected $accessTokenURL = 'https://api.sandbox.paypal.com/v1/oauth2/token'; |