TransientStoreHandler
in package
Class TransientStoreHandler.
Table of Contents
- $store : StoreInterface
- __construct() : mixed
- TransientStoreHandler constructor.
- defer() : void
- Defer saving state changes to destination to improve performance during blocks of changes.
- delete() : void
- Delete a stored value from storage.
- getNonce() : string
- Generate a random nonce value.
- getOnce() : string|null
- Get a value and delete it from storage.
- getStore() : StoreInterface
- Return the current storage method.
- isset() : bool
- Check if a key has a stored value or not.
- issue() : string
- Generate and store a random nonce value for a key.
- store() : void
- Store a value for a specific key.
- verify() : bool
- Get a value once and check that it matches an existing value.
Properties
$store
private
StoreInterface
$store
Methods
__construct()
TransientStoreHandler constructor.
public
__construct(StoreInterface $store) : mixed
Parameters
- $store : StoreInterface
-
storage method to use
Return values
mixed —defer()
Defer saving state changes to destination to improve performance during blocks of changes.
public
defer(bool $deferring) : void
Parameters
- $deferring : bool
-
whether to defer persisting the storage state
Tags
Return values
void —delete()
Delete a stored value from storage.
public
delete(string $key) : void
Parameters
- $key : string
-
key to get and delete
Return values
void —getNonce()
Generate a random nonce value.
public
getNonce([int $length = 16 ]) : string
Parameters
- $length : int = 16
-
length of the generated value, in bytes
Tags
Return values
string —getOnce()
Get a value and delete it from storage.
public
getOnce(string $key) : string|null
Parameters
- $key : string
-
key to get and delete
Return values
string|null —getStore()
Return the current storage method.
public
getStore() : StoreInterface
Return values
StoreInterface —isset()
Check if a key has a stored value or not.
public
isset(string $key) : bool
Parameters
- $key : string
-
key to check
Return values
bool —issue()
Generate and store a random nonce value for a key.
public
issue(string $key) : string
Parameters
- $key : string
-
key to use
Return values
string —store()
Store a value for a specific key.
public
store(string $key, string $value) : void
Parameters
- $key : string
-
key to use
- $value : string
-
value to store
Return values
void —verify()
Get a value once and check that it matches an existing value.
public
verify(string $key, string $expected) : bool
Parameters
- $key : string
-
key to get once
- $expected : string
-
value expected