DatabasePasswordResetTokenRepository
in package
implements
IPasswordResetTokenRepository
Database-backed password reset token repository.
Works with SQLite, MySQL, and PostgreSQL via PDO.
Table of Contents
Interfaces
- IPasswordResetTokenRepository
- Password reset token repository interface.
Properties
- $_pdo : PDO
Methods
- __construct() : mixed
- Constructor
- __sleep() : array<string|int, mixed>
- Handle serialization for PHPUnit process isolation
- __wakeup() : void
- Handle unserialization for PHPUnit process isolation
- create() : PasswordResetToken
- Create a new password reset token
- deleteByEmail() : int
- Delete all tokens for a given email address
- deleteByToken() : bool
- Delete a specific token by its hashed value
- deleteExpired() : int
- Delete all expired tokens
- findByToken() : PasswordResetToken|null
- Find a token by its hashed value
- mapRowToToken() : PasswordResetToken
- Map database row to PasswordResetToken object
Properties
$_pdo
private
PDO
$_pdo
Methods
__construct()
Constructor
public
__construct(SettingManager $settings) : mixed
Parameters
- $settings : SettingManager
-
Settings manager with database configuration
Tags
__sleep()
Handle serialization for PHPUnit process isolation
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__wakeup()
Handle unserialization for PHPUnit process isolation
public
__wakeup() : void
create()
Create a new password reset token
public
create(PasswordResetToken $token) : PasswordResetToken
Parameters
- $token : PasswordResetToken
-
Token to create
Return values
PasswordResetToken —Created token with ID set
deleteByEmail()
Delete all tokens for a given email address
public
deleteByEmail(string $email) : int
Parameters
- $email : string
-
Email address
Return values
int —Number of tokens deleted
deleteByToken()
Delete a specific token by its hashed value
public
deleteByToken(string $token) : bool
Parameters
- $token : string
-
Hashed token
Return values
bool —True if deleted, false otherwise
deleteExpired()
Delete all expired tokens
public
deleteExpired() : int
Return values
int —Number of tokens deleted
findByToken()
Find a token by its hashed value
public
findByToken(string $token) : PasswordResetToken|null
Parameters
- $token : string
-
Hashed token
Return values
PasswordResetToken|null —Token if found, null otherwise
mapRowToToken()
Map database row to PasswordResetToken object
private
mapRowToToken(array<string|int, mixed> $row) : PasswordResetToken
Parameters
- $row : array<string|int, mixed>