← All changes
|
vendor_prefixed/league/oauth2-client/src/Token/AccessToken.php
+10
-3
18.4
→
trunk
View file →
| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | * Represents an access token. |
| 21 | 21 | * |
| 22 | 22 | * @link http://tools.ietf.org/html/rfc6749#section-1.4 Access Token (RFC 6749, §1.4) |
| 23 | 23 | */ |
| 24 | -class AccessToken implements \YoastSEO_Vendor\League\OAuth2\Client\Token\AccessTokenInterface, \YoastSEO_Vendor\League\OAuth2\Client\Token\ResourceOwnerAccessTokenInterface | |
| 24 | +class AccessToken implements \YoastSEO_Vendor\League\OAuth2\Client\Token\AccessTokenInterface, \YoastSEO_Vendor\League\OAuth2\Client\Token\ResourceOwnerAccessTokenInterface, \YoastSEO_Vendor\League\OAuth2\Client\Token\SettableRefreshTokenInterface | |
| 25 | 25 | { |
| 26 | 26 | /** |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| @@ -102,9 +102,9 @@ | ||
| 102 | 102 | $this->expires = $options['expires_in'] != 0 ? $this->getTimeNow() + $options['expires_in'] : 0; |
| 103 | 103 | } elseif (!empty($options['expires'])) { |
| 104 | 104 | // Some providers supply the seconds until expiration rather than |
| 105 | 105 | // the exact timestamp. Take a best guess at which we received. |
| 106 | - $expires = $options['expires']; | |
| 106 | + $expires = (int) $options['expires']; | |
| 107 | 107 | if (!$this->isExpirationTimestamp($expires)) { |
| 108 | 108 | $expires += $this->getTimeNow(); |
| 109 | 109 | } |
| 110 | 110 | $this->expires = $expires; |
| @@ -144,8 +144,15 @@ | ||
| 144 | 144 | } |
| 145 | 145 | /** |
| 146 | 146 | * @inheritdoc |
| 147 | 147 | */ |
| 148 | + public function setRefreshToken($refreshToken) | |
| 149 | + { | |
| 150 | + $this->refreshToken = $refreshToken; | |
| 151 | + } | |
| 152 | + /** | |
| 153 | + * @inheritdoc | |
| 154 | + */ | |
| 148 | 155 | public function getExpires() |
| 149 | 156 | { |
| 150 | 157 | return $this->expires; |
| 151 | 158 | } |
| @@ -164,9 +171,9 @@ | ||
| 164 | 171 | $expires = $this->getExpires(); |
| 165 | 172 | if (empty($expires)) { |
| 166 | 173 | throw new \RuntimeException('"expires" is not set on the token'); |
| 167 | 174 | } |
| 168 | - return $expires < \time(); | |
| 175 | + return $expires < $this->getTimeNow(); | |
| 169 | 176 | } |
| 170 | 177 | /** |
| 171 | 178 | * @inheritdoc |
| 172 | 179 | */ |