Update captcha handling and introduce new captcha mechanism
This commit is contained in:
parent
706666af09
commit
38b96db83a
10 changed files with 189 additions and 6 deletions
53
src/Socialbox/Objects/Standard/ImageCaptcha.php
Normal file
53
src/Socialbox/Objects/Standard/ImageCaptcha.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Objects\Standard;
|
||||
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
use Socialbox\Objects\Database\CaptchaRecord;
|
||||
|
||||
class ImageCaptcha implements SerializableInterface
|
||||
{
|
||||
private int $expires;
|
||||
private string $image;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->expires = $data['expires'];
|
||||
$this->image = $data['image'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getExpires(): int
|
||||
{
|
||||
return $this->expires;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getImage(): string
|
||||
{
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): object
|
||||
{
|
||||
return new self($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'expires' => $this->expires,
|
||||
'image' => $this->image
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue