@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Implements an abstract OAuth1 provider with all methods required by the OAuth1Interface. |
23 | 23 | */ |
24 | -abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface{ |
|
24 | +abstract class OAuth1Provider extends OAuthProvider implements OAuth1Interface { |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * The request OAuth1 token URL |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | ->withHeader('Content-Length', '0') // tumblr requires a content-length header set |
61 | 61 | ; |
62 | 62 | |
63 | - foreach($this->authHeaders as $header => $value){ |
|
63 | + foreach ($this->authHeaders as $header => $value) { |
|
64 | 64 | $request = $request->withAddedHeader($header, $value); |
65 | 65 | } |
66 | 66 | |
@@ -77,20 +77,20 @@ discard block |
||
77 | 77 | protected function parseTokenResponse(ResponseInterface $response, bool $checkCallbackConfirmed = null):AccessToken{ |
78 | 78 | $data = $this->parseQuery(decompress_content($response)); |
79 | 79 | |
80 | - if(empty($data)){ |
|
80 | + if (empty($data)) { |
|
81 | 81 | throw new ProviderException('unable to parse token response'); |
82 | 82 | } |
83 | - elseif(isset($data['error'])){ |
|
83 | + elseif (isset($data['error'])) { |
|
84 | 84 | throw new ProviderException('error retrieving access token: '.$data['error']); |
85 | 85 | } |
86 | - elseif(!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])){ |
|
86 | + elseif (!isset($data['oauth_token']) || !isset($data['oauth_token_secret'])) { |
|
87 | 87 | throw new ProviderException('invalid token'); |
88 | 88 | } |
89 | 89 | |
90 | - if( |
|
90 | + if ( |
|
91 | 91 | $checkCallbackConfirmed |
92 | 92 | && (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') |
93 | - ){ |
|
93 | + ) { |
|
94 | 94 | throw new ProviderException('oauth callback unconfirmed'); |
95 | 95 | } |
96 | 96 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | protected function getSignature(string $url, array $params, string $method, string $accessTokenSecret = null):string{ |
134 | 134 | $parsed = parseUrl($url); |
135 | 135 | |
136 | - if(!isset($parsed['host']) || !isset($parsed['scheme']) || !in_array($parsed['scheme'], ['http', 'https'], true)){ |
|
136 | + if (!isset($parsed['host']) || !isset($parsed['scheme']) || !in_array($parsed['scheme'], ['http', 'https'], true)) { |
|
137 | 137 | throw new ProviderException('getSignature: invalid url'); |
138 | 138 | } |
139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | ]); |
151 | 151 | |
152 | 152 | // https://tools.ietf.org/html/rfc5849#section-3.4.2 |
153 | - $key = array_map('rawurlencode', [ |
|
153 | + $key = array_map('rawurlencode', [ |
|
154 | 154 | $this->options->secret, |
155 | 155 | $accessTokenSecret ?? '' |
156 | 156 | ]); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $token->accessTokenSecret |
198 | 198 | ); |
199 | 199 | |
200 | - if(isset($query['oauth_session_handle'])){ |
|
200 | + if (isset($query['oauth_session_handle'])) { |
|
201 | 201 | $parameters['oauth_session_handle'] = $query['oauth_session_handle']; // @codeCoverageIgnore |
202 | 202 | } |
203 | 203 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @property int $expires |
28 | 28 | * @property string $provider |
29 | 29 | */ |
30 | -final class AccessToken extends SettingsContainerAbstract{ |
|
30 | +final class AccessToken extends SettingsContainerAbstract { |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Denotes an unknown end of life time. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param iterable|null $properties |
82 | 82 | */ |
83 | - public function __construct(iterable $properties = null){ |
|
83 | + public function __construct(iterable $properties = null) { |
|
84 | 84 | parent::__construct($properties); |
85 | 85 | |
86 | 86 | $this->setExpiry($this->expires); |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | public function setExpiry(int $expires = null):AccessToken{ |
104 | 104 | $now = time(); |
105 | 105 | |
106 | - if($expires === 0 || $expires === $this::EOL_NEVER_EXPIRES){ |
|
106 | + if ($expires === 0 || $expires === $this::EOL_NEVER_EXPIRES) { |
|
107 | 107 | $this->expires = $this::EOL_NEVER_EXPIRES; |
108 | 108 | } |
109 | - elseif($expires > $now){ |
|
109 | + elseif ($expires > $now) { |
|
110 | 110 | $this->expires = $expires; |
111 | 111 | } |
112 | - elseif($expires > 0 && $expires < $this::EXPIRY_MAX){ |
|
112 | + elseif ($expires > 0 && $expires < $this::EXPIRY_MAX) { |
|
113 | 113 | $this->expires = $now + $expires; |
114 | 114 | } |
115 | - else{ |
|
115 | + else { |
|
116 | 116 | $this->expires = $this::EOL_UNKNOWN; |
117 | 117 | } |
118 | 118 |