mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-29 10:05:03 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -12,9 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Security\PasswordRecover;
|
||||
|
||||
use Chill\MainBundle\Redis\ChillRedis;
|
||||
use LogicException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class PasswordRecoverLocker
|
||||
{
|
||||
@@ -75,7 +73,7 @@ class PasswordRecoverLocker
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $usage 'invalid_token_global' or ...
|
||||
* @param string $usage 'invalid_token_global' or ...
|
||||
* @param mixed|null $discriminator
|
||||
*/
|
||||
public static function generateLockKey($usage, int $number, $discriminator = null)
|
||||
@@ -86,7 +84,7 @@ class PasswordRecoverLocker
|
||||
'ask_token_invalid_form_global' => sprintf('ask_token_invalid_form_global_%d', $number),
|
||||
'ask_token_invalid_form_by_ip' => sprintf('ask_token_invalid_form_by_ip_%s_%d', $discriminator, $number),
|
||||
'ask_token_success_by_user' => sprintf('ask_token_success_by_user_%s_%d', $discriminator->getId(), $number),
|
||||
default => throw new LogicException('this usage is not implemented'),
|
||||
default => throw new \LogicException('this usage is not implemented'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,7 +96,7 @@ class PasswordRecoverLocker
|
||||
'ask_token_invalid_form_global' => self::MAX_ASK_TOKEN_INVALID_FORM_GLOBAL,
|
||||
'ask_token_invalid_form_by_ip' => self::MAX_ASK_TOKEN_INVALID_FORM_BY_IP,
|
||||
'ask_token_success_by_user' => self::MAX_ASK_TOKEN_BY_USER,
|
||||
default => throw new UnexpectedValueException("this usage '{$usage}' is not yet implemented"),
|
||||
default => throw new \UnexpectedValueException("this usage '{$usage}' is not yet implemented"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -108,7 +106,7 @@ class PasswordRecoverLocker
|
||||
'invalid_token_global', 'invalid_token_by_ip' => self::INVALID_TOKEN_TTL,
|
||||
'ask_token_invalid_form_global', 'ask_token_invalid_form_by_ip' => self::ASK_TOKEN_INVALID_FORM_TTL,
|
||||
'ask_token_success_by_user' => self::ASK_TOKEN_INVALID_FORM_TTL * 24,
|
||||
default => throw new UnexpectedValueException("this usage '{$usage}' is not yet implemented"),
|
||||
default => throw new \UnexpectedValueException("this usage '{$usage}' is not yet implemented"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -119,7 +117,7 @@ class PasswordRecoverLocker
|
||||
for ($i = 0; $i < $max; ++$i) {
|
||||
$key = self::generateLockKey($usage, $i, $discriminator);
|
||||
|
||||
if ($this->chillRedis->exists($key) === 0) {
|
||||
if (0 === $this->chillRedis->exists($key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user