芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/optimyar/wp-content/plugins/wordpress-seo/src/values/oauth/oauth-token.php
access_token = $access_token; if ( empty( $refresh_token ) ) { throw new Empty_Property_Exception( 'refresh_token' ); } $this->refresh_token = $refresh_token; if ( empty( $expires ) ) { throw new Empty_Property_Exception( 'expires' ); } $this->expires = $expires; if ( $has_expired === null ) { throw new Empty_Property_Exception( 'has_expired' ); } $this->has_expired = $has_expired; $this->created_at = $created_at; $this->error_count = $error_count; } /** * Creates a new instance based on the passed response. * * @param AccessTokenInterface $response The response object to create a new instance from. * * @return OAuth_Token The token object. * * @throws Empty_Property_Exception Exception thrown if a token property is empty. */ public static function from_response( AccessTokenInterface $response ) { return new self( $response->getToken(), $response->getRefreshToken(), $response->getExpires(), $response->hasExpired(), \time() ); } /** * Determines whether or not the token has expired. * * @return bool Whether or not the token has expired. */ public function has_expired() { return ( \time() >= $this->expires ) || $this->has_expired === true; } /** * Converts the object to an array. * * @return array The converted object. */ public function to_array() { return [ 'access_token' => $this->access_token, 'refresh_token' => $this->refresh_token, 'expires' => $this->expires, 'has_expired' => $this->has_expired(), 'created_at' => $this->created_at, 'error_count' => $this->error_count, ]; } }