Code Duplication    Length = 22-24 lines in 4 locations

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

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