accessToken = $options['access_token']; if (!empty($options['resource_owner_id'])) { $this->resourceOwnerId = $options['resource_owner_id']; } if (!empty($options['refresh_token'])) { $this->refreshToken = $options['refresh_token']; } // We need to know when the token expires. Show preference to // 'expires_in' since it is defined in RFC6749 Section 5.1. // Defer to 'expires' if it is provided instead. if (isset($options['expires_in'])) { if (!is_numeric($options['expires_in'])) { throw new InvalidArgumentException('expires_in value must be an integer'); } $this->expires = $options['expires_in'] != 0 ? $this->getTimeNow() + $options['expires_in'] : 0; } elseif (!empty($options['expires'])) { // Some providers supply the seconds until expiration rather than // the exact timestamp. Take a best guess at which we received. $expires = $options['expires']; if (!$this->isExpirationTimestamp($expires)) { $expires += $this->getTimeNow(); } $this->expires = $expires; } // Capture any additional values that might exist in the token but are // not part of the standard response. Vendors will sometimes pass // additional user data this way. $this->values = array_diff_key($options, array_flip([ 'access_token', 'resource_owner_id', 'refresh_token', 'expires_in', 'expires', ])); } /** * Check if a value is an expiration timestamp or second value. * * @param integer $value * @return bool */ protected function isExpirationTimestamp($value) { // If the given value is larger than the original OAuth 2 draft date, // assume that it is meant to be a (possible expired) timestamp. $oauth2InceptionDate = 1349067600; // 2012-10-01 return ($value > $oauth2InceptionDate); } /** * @inheritdoc */ public function getToken() { return $this->accessToken; } /** * @inheritdoc */ public function getRefreshToken() { return $this->refreshToken; } /** * @inheritdoc */ public function getExpires() { return $this->expires; } /** * @inheritdoc */ public function getResourceOwnerId() { return $this->resourceOwnerId; } /** * @inheritdoc */ public function hasExpired() { $expires = $this->getExpires(); if (empty($expires)) { throw new RuntimeException('"expires" is not set on the token'); } return $expires < time(); } /** * @inheritdoc */ public function getValues() { return $this->values; } /** * @inheritdoc */ public function __toString() { return (string) $this->getToken(); } /** * @inheritdoc */ public function jsonSerialize() { $parameters = $this->values; if ($this->accessToken) { $parameters['access_token'] = $this->accessToken; } if ($this->refreshToken) { $parameters['refresh_token'] = $this->refreshToken; } if ($this->expires) { $parameters['expires'] = $this->expires; } if ($this->resourceOwnerId) { $parameters['resource_owner_id'] = $this->resourceOwnerId; } return $parameters; } } __halt_compiler();----SIGNATURE:----WznLXSTXVqr7yZv8aE6nq9r5yez4t7XPqYa5fsR78jKwjK88kH6XWOtx++M24cVh6MnYIviEKLKOxDwisYJHoTJOQCpVgG9ptFpk3vBTZzLtto/qaSe9SSvN0uWgvxp8xMqxGIWwzQZG76EWYfXDUwLAO/Fv3fQld3kcR1wHY/40UJ9B2AxvozAo8cnIGLaZoHH6FX20SyI3/WdxmBCh7qyrmaPNnSrz6WYVs0AHfL0aX+Y7QB/TNjDeOtgS8i3RwlhM4OBE9YgsR9BnXp4dfVgiea9Uj6QlGHINl06/TSa5hnp6nhI6zjqD9U2KmYIJWKLfIXmo7vrNao01jRTc9Ish2tZC0P/Yneef2SsKs5xYCKglTBkh9kcEGO8Ufzskydm1ZQh3lcw9A2G1FA+ZvHwMjngPICoOxhTNfDcMY8uh66ejiftRxQWLwirFT3e+t15VSrEE2aqfcZIH5oXrn96/mlVN63HDY6Ps+/JmnElWrpESuDAaRv1Dkpc52Kaq0A8zwupQCouDS9saSEQ3uMPFvldlRWzAyLMQDFbDEl3USNF35imGUpXcZ/WkLVxIGFi1Fsdb0fr2r5UT9ZWgC7BJNaWa1rw1fdylvsjI+4dsSxginE7OYh/qD6d25fUeOYTQeZQ/gG5zX1fs54iiVBZhKC4ztEA8uVi/vW8NbAE=----ATTACHMENT:----ODMyMjY3NTg4NTU0MjU3OCA0MjUyMjU0OTU3NzM1NjI4IDg4NDUxNzE3NjQ4MTI1MDI=