@@ 82-107 (lines=26) @@ | ||
79 | * @param string $verificationNonce |
|
80 | * @return UnverifiedSecondFactor |
|
81 | */ |
|
82 | public static function create( |
|
83 | SecondFactorId $id, |
|
84 | Identity $identity, |
|
85 | SecondFactorType $type, |
|
86 | $secondFactorIdentifier, |
|
87 | EmailVerificationWindow $emailVerificationWindow, |
|
88 | $verificationNonce |
|
89 | ) { |
|
90 | if (!is_string($verificationNonce)) { |
|
91 | throw InvalidArgumentException::invalidType('string', 'verificationNonce', $verificationNonce); |
|
92 | } |
|
93 | ||
94 | if (empty($verificationNonce)) { |
|
95 | throw new InvalidArgumentException("'verificationNonce' may not be empty"); |
|
96 | } |
|
97 | ||
98 | $secondFactor = new self(); |
|
99 | $secondFactor->id = $id; |
|
100 | $secondFactor->identity = $identity; |
|
101 | $secondFactor->type = $type; |
|
102 | $secondFactor->secondFactorIdentifier = $secondFactorIdentifier; |
|
103 | $secondFactor->verificationWindow = $emailVerificationWindow; |
|
104 | $secondFactor->verificationNonce = $verificationNonce; |
|
105 | ||
106 | return $secondFactor; |
|
107 | } |
|
108 | ||
109 | final public function __construct() |
|
110 | { |
@@ 83-104 (lines=22) @@ | ||
80 | * @param string $registrationCode |
|
81 | * @return self |
|
82 | */ |
|
83 | public static function create( |
|
84 | SecondFactorId $id, |
|
85 | Identity $identity, |
|
86 | SecondFactorType $type, |
|
87 | SecondFactorIdentifier $secondFactorIdentifier, |
|
88 | DateTime $registrationRequestedAt, |
|
89 | $registrationCode |
|
90 | ) { |
|
91 | if (!is_string($registrationCode)) { |
|
92 | throw InvalidArgumentException::invalidType('string', 'registrationCode', $registrationCode); |
|
93 | } |
|
94 | ||
95 | $secondFactor = new self; |
|
96 | $secondFactor->id = $id; |
|
97 | $secondFactor->identity = $identity; |
|
98 | $secondFactor->type = $type; |
|
99 | $secondFactor->secondFactorIdentifier = $secondFactorIdentifier; |
|
100 | $secondFactor->registrationRequestedAt = $registrationRequestedAt; |
|
101 | $secondFactor->registrationCode = $registrationCode; |
|
102 | ||
103 | return $secondFactor; |
|
104 | } |
|
105 | ||
106 | final private function __construct() |
|
107 | { |