Renamed PeerRecord to PeerDatabaseRecord

This commit is contained in:
netkas 2025-01-31 15:13:12 -05:00
parent 148a65c2f7
commit 7a39b0fd35
8 changed files with 99 additions and 110 deletions

View file

@ -10,21 +10,21 @@
use Socialbox\Enums\Status\CaptchaStatus;
use Socialbox\Exceptions\DatabaseOperationException;
use Socialbox\Objects\Database\CaptchaRecord;
use Socialbox\Objects\Database\PeerRecord;
use Socialbox\Objects\Database\PeerDatabaseRecord;
class CaptchaManager
{
/**
* Creates a new captcha for the given peer UUID.
*
* @param string|PeerRecord $peer_uuid The UUID of the peer to create the captcha for.
* @param string|PeerDatabaseRecord $peer_uuid The UUID of the peer to create the captcha for.
* @return string The answer to the captcha.
* @throws DatabaseOperationException If the operation fails.
*/
public static function createCaptcha(string|PeerRecord $peer_uuid): string
public static function createCaptcha(string|PeerDatabaseRecord $peer_uuid): string
{
// If the peer_uuid is a RegisteredPeerRecord, get the UUID
if($peer_uuid instanceof PeerRecord)
if($peer_uuid instanceof PeerDatabaseRecord)
{
$peer_uuid = $peer_uuid->getUuid();
}
@ -73,14 +73,14 @@
/**
* Answers a captcha for the given peer UUID.
*
* @param string|PeerRecord $peer_uuid The UUID of the peer to answer the captcha for.
* @param string|PeerDatabaseRecord $peer_uuid The UUID of the peer to answer the captcha for.
* @param string $answer The answer to the captcha.
* @return bool True if the answer is correct, false otherwise.
* @throws DatabaseOperationException If the operation fails.
*/
public static function answerCaptcha(string|PeerRecord $peer_uuid, string $answer): bool
public static function answerCaptcha(string|PeerDatabaseRecord $peer_uuid, string $answer): bool
{
if($peer_uuid instanceof PeerRecord)
if($peer_uuid instanceof PeerDatabaseRecord)
{
$peer_uuid = $peer_uuid->getUuid();
}
@ -129,14 +129,14 @@
/**
* Retrieves the captcha record for the given peer UUID.
*
* @param string|PeerRecord $peer_uuid The UUID of the peer to retrieve the captcha for.
* @param string|PeerDatabaseRecord $peer_uuid The UUID of the peer to retrieve the captcha for.
* @return CaptchaRecord|null The captcha record.
* @throws DatabaseOperationException If the operation fails.
*/
public static function getCaptcha(string|PeerRecord $peer_uuid): ?CaptchaRecord
public static function getCaptcha(string|PeerDatabaseRecord $peer_uuid): ?CaptchaRecord
{
// If the peer_uuid is a RegisteredPeerRecord, get the UUID
if($peer_uuid instanceof PeerRecord)
if($peer_uuid instanceof PeerDatabaseRecord)
{
$peer_uuid = $peer_uuid->getUuid();
}
@ -166,14 +166,14 @@
/**
* Checks if a captcha exists for the given peer UUID.
*
* @param string|PeerRecord $peer_uuid The UUID of the peer to check for a captcha.
* @param string|PeerDatabaseRecord $peer_uuid The UUID of the peer to check for a captcha.
* @return bool True if a captcha exists, false otherwise.
* @throws DatabaseOperationException If the operation fails.
*/
public static function captchaExists(string|PeerRecord $peer_uuid): bool
public static function captchaExists(string|PeerDatabaseRecord $peer_uuid): bool
{
// If the peer_uuid is a RegisteredPeerRecord, get the UUID
if($peer_uuid instanceof PeerRecord)
if($peer_uuid instanceof PeerDatabaseRecord)
{
$peer_uuid = $peer_uuid->getUuid();
}