summaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes/lib/Provider
diff options
context:
space:
mode:
Diffstat (limited to 'apps/twofactor_backupcodes/lib/Provider')
-rw-r--r--apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php
index f5b01649bbb..03d1ee0d405 100644
--- a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php
+++ b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
@@ -49,7 +50,7 @@ class BackupCodesProvider implements IProvider {
* @param IL10N $l10n
* @param AppManager $appManager
*/
- public function __construct($appName, BackupCodeStorage $storage, IL10N $l10n, AppManager $appManager) {
+ public function __construct(string $appName, BackupCodeStorage $storage, IL10N $l10n, AppManager $appManager) {
$this->appName = $appName;
$this->l10n = $l10n;
$this->storage = $storage;
@@ -61,7 +62,7 @@ class BackupCodesProvider implements IProvider {
*
* @return string
*/
- public function getId() {
+ public function getId(): string {
return 'backup_codes';
}
@@ -70,7 +71,7 @@ class BackupCodesProvider implements IProvider {
*
* @return string
*/
- public function getDisplayName() {
+ public function getDisplayName(): string {
return $this->l10n->t('Backup code');
}
@@ -79,7 +80,7 @@ class BackupCodesProvider implements IProvider {
*
* @return string
*/
- public function getDescription() {
+ public function getDescription(): string {
return $this->l10n->t('Use backup code');
}
@@ -89,7 +90,7 @@ class BackupCodesProvider implements IProvider {
* @param IUser $user
* @return Template
*/
- public function getTemplate(IUser $user) {
+ public function getTemplate(IUser $user): Template {
return new Template('twofactor_backupcodes', 'challenge');
}
@@ -98,8 +99,9 @@ class BackupCodesProvider implements IProvider {
*
* @param IUser $user
* @param string $challenge
+ * @return bool
*/
- public function verifyChallenge(IUser $user, $challenge) {
+ public function verifyChallenge(IUser $user, string $challenge): bool {
return $this->storage->validateCode($user, $challenge);
}
@@ -109,7 +111,7 @@ class BackupCodesProvider implements IProvider {
* @param IUser $user
* @return boolean
*/
- public function isTwoFactorAuthEnabledForUser(IUser $user) {
+ public function isTwoFactorAuthEnabledForUser(IUser $user): bool {
return $this->storage->hasBackupCodes($user);
}
@@ -124,7 +126,7 @@ class BackupCodesProvider implements IProvider {
* @param IUser $user
* @return boolean
*/
- public function isActive(IUser $user) {
+ public function isActive(IUser $user): bool {
$appIds = array_filter($this->appManager->getEnabledAppsForUser($user), function($appId) {
return $appId !== $this->appName;
});