Documentation

AccessToken
in package
implements AccessTokenInterface, ResourceOwnerAccessTokenInterface, SettableRefreshTokenInterface

Represents an access token.

Tags
link

Access Token (RFC 6749, §1.4)

Table of Contents

Interfaces

AccessTokenInterface
ResourceOwnerAccessTokenInterface
SettableRefreshTokenInterface

Properties

$accessToken  : string
$expires  : int
$refreshToken  : string
$resourceOwnerId  : string
$values  : array<string|int, mixed>
$timeNow  : int

Methods

__construct()  : mixed
Constructs an access token.
__toString()  : string
Returns a string representation of the access token
getExpires()  : int|null
Returns the expiration timestamp in seconds, if defined.
getRefreshToken()  : string|null
Returns the refresh token, if defined.
getResourceOwnerId()  : string|null
Returns the resource owner identifier, if defined.
getTimeNow()  : int
getToken()  : string
Returns the access token string of this instance.
getValues()  : array<string|int, mixed>
Returns additional vendor values stored in the token.
hasExpired()  : bool
Checks if this token has expired.
jsonSerialize()  : array<string|int, mixed>
Returns an array of parameters to serialize when this is serialized with json_encode().
resetTimeNow()  : void
Reset the time now if it was set for test purposes.
setRefreshToken()  : void
Sets or replaces the refresh token with the provided refresh token.
setTimeNow()  : void
Set the time now. This should only be used for testing purposes.
isExpirationTimestamp()  : bool
Check if a value is an expiration timestamp or second value.

Properties

$values

protected array<string|int, mixed> $values = []

Methods

__construct()

Constructs an access token.

public __construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
$options : array<string|int, mixed> = []

An array of options returned by the service provider in the access token request. The access_token option is required.

Tags
throws
InvalidArgumentException

if access_token is not provided in $options.

__toString()

Returns a string representation of the access token

public __toString() : string
Tags
inheritdoc
Return values
string

getExpires()

Returns the expiration timestamp in seconds, if defined.

public getExpires() : int|null
Tags
inheritdoc
Return values
int|null

getRefreshToken()

Returns the refresh token, if defined.

public getRefreshToken() : string|null
Tags
inheritdoc
Return values
string|null

getResourceOwnerId()

Returns the resource owner identifier, if defined.

public getResourceOwnerId() : string|null
Tags
inheritdoc
Return values
string|null

getTimeNow()

public getTimeNow() : int
Return values
int

getToken()

Returns the access token string of this instance.

public getToken() : string
Tags
inheritdoc
Return values
string

getValues()

Returns additional vendor values stored in the token.

public getValues() : array<string|int, mixed>
Tags
inheritdoc
Return values
array<string|int, mixed>

hasExpired()

Checks if this token has expired.

public hasExpired() : bool
Tags
inheritdoc
Return values
bool

true if the token has expired, false otherwise.

jsonSerialize()

Returns an array of parameters to serialize when this is serialized with json_encode().

public jsonSerialize() : array<string|int, mixed>
Tags
inheritdoc
Return values
array<string|int, mixed>

resetTimeNow()

Reset the time now if it was set for test purposes.

public static resetTimeNow() : void

setRefreshToken()

Sets or replaces the refresh token with the provided refresh token.

public setRefreshToken(mixed $refreshToken) : void
Parameters
$refreshToken : mixed
Tags
inheritdoc

setTimeNow()

Set the time now. This should only be used for testing purposes.

public static setTimeNow(int $timeNow) : void
Parameters
$timeNow : int

the time in seconds since epoch

isExpirationTimestamp()

Check if a value is an expiration timestamp or second value.

protected isExpirationTimestamp(int $value) : bool
Parameters
$value : int
Return values
bool

        
On this page

Search results