AccessTokenService
extends AbstractDbService
in package
implements
AccessTokenServiceInterface, DeleteExpiredInterface, LoggerAwareInterface
Uses
LoggerAwareTrait
Database service for access tokens.
Tags
Interfaces, Classes, Traits and Enums
- AccessTokenServiceInterface
- Database service interface for access tokens.
- DeleteExpiredInterface
- Interface for exposing the "deleteExpired" method required by command line cleanup tools.
- LoggerAwareInterface
Table of Contents
- $accessTokenTable : AccessToken
- __construct() : mixed
- Constructor.
- deleteExpired() : int
- Delete expired records. Allows setting a limit so that rows can be deleted in small batches.
- getByIdAndType() : AccessTokenEntityInterface|null
- Retrieve an object from the database based on id and type; create a new row if no existing match is found.
- getNonce() : string|null
- Retrieve an OpenID nonce for a user
- persistEntity() : void
- Persist an entity.
- storeNonce() : void
- Add or replace an OpenID nonce for a user
- debug() : void
- Log a debug message.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
Properties
$accessTokenTable
protected
AccessToken
$accessTokenTable
Methods
__construct()
Constructor.
public
__construct(AccessToken $accessTokenTable) : mixed
Parameters
- $accessTokenTable : AccessToken
-
Access token table
Return values
mixed —deleteExpired()
Delete expired records. Allows setting a limit so that rows can be deleted in small batches.
public
deleteExpired(DateTime $dateLimit[, int|null $limit = null ]) : int
Parameters
- $dateLimit : DateTime
-
Date threshold of an "expired" record.
- $limit : int|null = null
-
Maximum number of rows to delete or null for no limit.
Return values
int —Number of rows deleted
getByIdAndType()
Retrieve an object from the database based on id and type; create a new row if no existing match is found.
public
getByIdAndType(string $id, string $type[, bool $create = true ]) : AccessTokenEntityInterface|null
Parameters
- $id : string
-
Token ID
- $type : string
-
Token type
- $create : bool = true
-
Should we create rows that don't already exist?
Return values
AccessTokenEntityInterface|null —getNonce()
Retrieve an OpenID nonce for a user
public
getNonce(int $userId) : string|null
Parameters
- $userId : int
-
User ID
Return values
string|null —persistEntity()
Persist an entity.
public
persistEntity(EntityInterface $entity) : void
Parameters
- $entity : EntityInterface
-
Entity to persist.
Return values
void —storeNonce()
Add or replace an OpenID nonce for a user
public
storeNonce(int $userId, string|null $nonce) : void
Parameters
- $userId : int
-
User ID
- $nonce : string|null
-
Nonce
Return values
void —debug()
Log a debug message.
protected
debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —log()
Send a message to the logger.
protected
log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
- $level : string
-
Log level
- $message : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = false
-
Prepend class name to message?
Return values
void —logError()
Log an error message.
protected
logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —logWarning()
Log a warning message.
protected
logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?