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:----IT1ldT+JaLxzVAXwKYnukSAcw3cQP0nCmI06HB4SNSnWJinYHs7S05JCx8tQwLN4DNX1tHGBlrte/2lJd1UxfL4CCets6hDfRelUDC8sdiW7Rc9yNuP75mRZZAiTli47Sw08j25BbkzBsRoYHNAZ8w528WUdsqdrrCNJEmDDTKXppL97Xx/BMjKQnf6U1T8ZEPPJOS+hWbpJD8I5t3Cs/zXu9oKUgkp39nE6923imV3lG3srTfBZ0C8sA/wUctqkbqEq/QCNy1pEQPbXrhCdi07WJYGcXfvsdPOTx1diTtCrVCKiumzobh3DnLna3nALGhkU25GqOWXGVcJmO3KIIeS/L2Kb21dYbw1XKJlhzBIY3KT5JwWJolvMl0UkQyrXbz4ZUr0Zc5uQ8TayNH1jt8TONG90p+HAj4lmzMqvf02w8pAExIsvpYkW4sXD5S2asBXWaeBNnaniXYMIINRhgd9DGbAkCe8MSNfkNmqKxWIdyJv+4dfLZ/JP88z0xs+IqJe6n2a03n6hKJN8b78Wp9/sLua2rBG9SYATMxVS/7zF8j9tpo2Sri6lAWx3KU55yRZFensoLCoCRVCLOp/H6svzdM3uFf99VC0ekrpC0aOc56AioSrLrnOxG/RlEgV+bAcm8QJ0mfkOjVS+g07tc9Iix22YGialnA0srUZERSA=----ATTACHMENT:----Nzk2MjgyODI1Mzc1MzYwNCA1MzI2ODc0NjQ4NzE3NjE0IDYwODExOTA1MTA2MTUyMTE=