feat(altcha): add altcha validation layer to login
Some checks are pending
Cadoles/hydra-sql/pipeline/pr-develop Build started...
Some checks are pending
Cadoles/hydra-sql/pipeline/pr-develop Build started...
This commit is contained in:
26
src/Flag/FlagAccessor.php
Normal file
26
src/Flag/FlagAccessor.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Flag;
|
||||
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
|
||||
class FlagAccessor
|
||||
{
|
||||
public const FLAG_VALUE = 'flagValue';
|
||||
|
||||
public function __construct(
|
||||
private readonly CacheItemPoolInterface $cache
|
||||
) {
|
||||
}
|
||||
|
||||
public function isFlagEnabled(FlagEnum $flagName, bool $fallbackValue = false): bool
|
||||
{
|
||||
$flagValue = $this->cache->getItem($flagName->value)->get();
|
||||
|
||||
if (null === $flagValue) {
|
||||
return $fallbackValue;
|
||||
}
|
||||
|
||||
return (bool) $flagValue;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user