mirror of
https://github.com/RobThree/TwoFactorAuth.git
synced 2026-08-28 11:06:53 +00:00
add readonly modifiers wherever possible
This commit is contained in:
@@ -8,7 +8,7 @@ use function in_array;
|
||||
|
||||
class HashRNGProvider implements IRNGProvider
|
||||
{
|
||||
public function __construct(private string $algorithm = 'sha256')
|
||||
public function __construct(private readonly string $algorithm = 'sha256')
|
||||
{
|
||||
$algos = array_values(hash_algos());
|
||||
if (!in_array($this->algorithm, $algos, true)) {
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace RobThree\Auth\Providers\Rng;
|
||||
|
||||
class OpenSSLRNGProvider implements IRNGProvider
|
||||
{
|
||||
public function __construct(private bool $requirestrong = true)
|
||||
public function __construct(private readonly bool $requirestrong = true)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ class TwoFactorAuth
|
||||
private static array $_base32lookup = array();
|
||||
|
||||
public function __construct(
|
||||
private ?string $issuer = null,
|
||||
private int $digits = 6,
|
||||
private int $period = 30,
|
||||
private Algorithm $algorithm = Algorithm::Sha1,
|
||||
private ?IQRCodeProvider $qrcodeprovider = null,
|
||||
private ?IRNGProvider $rngprovider = null,
|
||||
private ?ITimeProvider $timeprovider = null
|
||||
private readonly ?string $issuer = null,
|
||||
private readonly int $digits = 6,
|
||||
private readonly int $period = 30,
|
||||
private readonly Algorithm $algorithm = Algorithm::Sha1,
|
||||
private ?IQRCodeProvider $qrcodeprovider = null,
|
||||
private ?IRNGProvider $rngprovider = null,
|
||||
private ?ITimeProvider $timeprovider = null
|
||||
) {
|
||||
if ($this->digits <= 0) {
|
||||
throw new TwoFactorAuthException('Digits must be > 0');
|
||||
|
||||
Reference in New Issue
Block a user