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:----sZPen8+Plhsfgl6YnT6P4Zz/p1JpOyGGX591JRFeo0bx/Ma+mkn6cWtcILLmDAz5yZGOilTZhK2JwTRhN5qHzzDYhugsUEwvDCF/2+4nozqKQ90K1GGOxyau3akBalt2gQEBqA7EbP8x+cR2BwS55A4VKYlERegImSo1D0OtlqftW0QA/YBKO9e/eDeusOp7NYEWbLvRfHCoVshKHGRB0xzfz+2CfxkJJeLXD7Okjnj/GsoAiOwDYodB9Q4/0AfHZSRuGBjS2+h80vOfXqA3AaVFlXREeQj822+5OApSrii6ZBX539+yZzMVztGRHAaAamgmTzl+ohYNqJejXzKC89B1Xe6ehNuCB/tVzLuvPVphfeJT83/e4zmtc0B6aiH3UJbvLyjuJY8X/2h3rs7KBBtQiTfMBxNvVa4n4mHxFQqOmBqDrYACwEBX1jNg9uMHWMVR7Bx6de4QI786lnKMar4cZZYbHzAmboZsbhKzJeM69xsgxg7H2BgYIO+AlMGF0M0Z1G+dOq2w0c6rSwiVnaohMdtDMTxPNuPR3qdBgeqmlkw3tYTQn0Yp14JhuemHukKXbC9sqwYmqk6aNyaLmtQr5O9rgDhSl1vYRVgKCLofzeFuHmy1jIRHq2YIEJA38ml1pVUOb65KzhRvLj7HmwGwOWL55w4Ht3JCLXePcPQ=----ATTACHMENT:----NDc2NzcwMDU2MDc2NzAxMSA3MDkyNDQ5NDg1OTQ1MzkwIDI4MzY3NDM4OTU1MDA4NjQ=