feat(altcha): add altcha validation layer to login
This commit is contained in:
24
src/Flag/FlagAccessor.php
Normal file
24
src/Flag/FlagAccessor.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Flag;
|
||||
|
||||
use Predis\ClientInterface;
|
||||
|
||||
class FlagAccessor
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ClientInterface $redis
|
||||
) {
|
||||
}
|
||||
|
||||
public function isFlagEnabled(FlagEnum $flagName, bool $fallbackValue = false): bool
|
||||
{
|
||||
$flagValue = $this->redis->get($flagName->value);
|
||||
|
||||
if (null === $flagValue) {
|
||||
return $fallbackValue;
|
||||
}
|
||||
|
||||
return (bool) $flagValue;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user