Code Duplication    Length = 22-24 lines in 4 locations

src/Surfnet/Stepup/Identity/Identity.php 4 locations

@@ 212-233 (lines=22) @@
209
        );
210
    }
211
212
    public function provePossessionOfYubikey(
213
        SecondFactorId $secondFactorId,
214
        YubikeyPublicId $yubikeyPublicId,
215
        EmailVerificationWindow $emailVerificationWindow
216
    ) {
217
        $this->assertNotForgotten();
218
        $this->assertUserMayAddSecondFactor();
219
220
        $this->apply(
221
            new YubikeyPossessionProvenEvent(
222
                $this->id,
223
                $this->institution,
224
                $secondFactorId,
225
                $yubikeyPublicId,
226
                $emailVerificationWindow,
227
                TokenGenerator::generateNonce(),
228
                $this->commonName,
229
                $this->email,
230
                $this->preferredLocale
231
            )
232
        );
233
    }
234
235
    public function provePossessionOfPhone(
236
        SecondFactorId $secondFactorId,
@@ 235-256 (lines=22) @@
232
        );
233
    }
234
235
    public function provePossessionOfPhone(
236
        SecondFactorId $secondFactorId,
237
        PhoneNumber $phoneNumber,
238
        EmailVerificationWindow $emailVerificationWindow
239
    ) {
240
        $this->assertNotForgotten();
241
        $this->assertUserMayAddSecondFactor();
242
243
        $this->apply(
244
            new PhonePossessionProvenEvent(
245
                $this->id,
246
                $this->institution,
247
                $secondFactorId,
248
                $phoneNumber,
249
                $emailVerificationWindow,
250
                TokenGenerator::generateNonce(),
251
                $this->commonName,
252
                $this->email,
253
                $this->preferredLocale
254
            )
255
        );
256
    }
257
258
    public function provePossessionOfGssf(
259
        SecondFactorId $secondFactorId,
@@ 258-281 (lines=24) @@
255
        );
256
    }
257
258
    public function provePossessionOfGssf(
259
        SecondFactorId $secondFactorId,
260
        StepupProvider $provider,
261
        GssfId $gssfId,
262
        EmailVerificationWindow $emailVerificationWindow
263
    ) {
264
        $this->assertNotForgotten();
265
        $this->assertUserMayAddSecondFactor();
266
267
        $this->apply(
268
            new GssfPossessionProvenEvent(
269
                $this->id,
270
                $this->institution,
271
                $secondFactorId,
272
                $provider,
273
                $gssfId,
274
                $emailVerificationWindow,
275
                TokenGenerator::generateNonce(),
276
                $this->commonName,
277
                $this->email,
278
                $this->preferredLocale
279
            )
280
        );
281
    }
282
283
    public function provePossessionOfU2fDevice(
284
        SecondFactorId $secondFactorId,
@@ 283-304 (lines=22) @@
280
        );
281
    }
282
283
    public function provePossessionOfU2fDevice(
284
        SecondFactorId $secondFactorId,
285
        U2fKeyHandle $keyHandle,
286
        EmailVerificationWindow $emailVerificationWindow
287
    ) {
288
        $this->assertNotForgotten();
289
        $this->assertUserMayAddSecondFactor();
290
291
        $this->apply(
292
            new U2fDevicePossessionProvenEvent(
293
                $this->id,
294
                $this->institution,
295
                $secondFactorId,
296
                $keyHandle,
297
                $emailVerificationWindow,
298
                TokenGenerator::generateNonce(),
299
                $this->commonName,
300
                $this->email,
301
                $this->preferredLocale
302
            )
303
        );
304
    }
305
306
    public function verifyEmail($verificationNonce)
307
    {