Code Duplication    Length = 22-26 lines in 2 locations

src/Surfnet/Stepup/Identity/Entity/UnverifiedSecondFactor.php 1 location

@@ 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
    {

src/Surfnet/Stepup/Identity/Entity/VerifiedSecondFactor.php 1 location

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