From db7480be38c7f271e148e3ab798f073116076dc6 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 11 Mar 2024 11:14:12 +0100 Subject: [PATCH] Create class 'SecondFactorRequiredException' --- src/SecondFactorRequiredException.php | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/SecondFactorRequiredException.php diff --git a/src/SecondFactorRequiredException.php b/src/SecondFactorRequiredException.php new file mode 100644 index 0000000..4ed17e2 --- /dev/null +++ b/src/SecondFactorRequiredException.php @@ -0,0 +1,62 @@ +totp); + } + + public function hasSmsOption() { + return !empty($this->smsRecipient) && !empty($this->smsOtpValue); + } + + public function getSmsRecipient() { + return $this->smsRecipient; + } + + public function getSmsOtpValue() { + return $this->smsOtpValue; + } + + public function hasEmailOption() { + return !empty($this->emailRecipient) && !empty($this->emailOtpValue); + } + + public function getEmailRecipient() { + return $this->emailRecipient; + } + + public function getEmailOtpValue() { + return $this->emailOtpValue; + } + + public function addTotpOption() { + $this->totp = true; + } + + public function addSmsOption($recipient, $otpValue) { + $this->smsRecipient = !empty($recipient) ? (string) $recipient : null; + $this->smsOtpValue = !empty($otpValue) ? (string) $otpValue : null; + } + + public function addEmailOption($recipient, $otpValue) { + $this->emailRecipient = !empty($recipient) ? (string) $recipient : null; + $this->emailOtpValue = !empty($otpValue) ? (string) $otpValue : null; + } + +}