class TokenStorage

Class TokenStorage

Properties

protected Token $lastToken

Methods

__construct(bool $tokenFile)

TokenStorage constructor.

getLastToken()

No description

addHeader(RequestInterface $request)

Adds token header to the supplied request.

checkResponseForAuthToken(RequestInterface $request, MessageInterface $response)

No description

save(string $filename)

Saves last token to a file.

load(string $filename)

Load token from a serialized formatted file.

__destruct()

Saves the file when shutting down

Details

at line 24
__construct(bool $tokenFile)

TokenStorage constructor.

Parameters

bool $tokenFile

at line 39
Token getLastToken()

Return Value

Token

at line 49
addHeader(RequestInterface $request)

Adds token header to the supplied request.

Parameters

RequestInterface $request A request object

at line 63
checkResponseForAuthToken(RequestInterface $request, MessageInterface $response)

Parameters

RequestInterface $request
MessageInterface $response

at line 79
save(string $filename)

Saves last token to a file.

Parameters

string $filename File to save

Exceptions

RuntimeException if the file cannot be found or created

at line 98
load(string $filename)

Load token from a serialized formatted file.

Parameters

string $filename Token file to load.

Exceptions

RuntimeException if the file cannot be loaded.

at line 118
__destruct()

Saves the file when shutting down