Passed
Push — develop ( 3b27a1...7bbf61 )
by Baptiste
02:37
created

TwoFactorAuthenticationWasEnabled   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A email() 0 3 1
A recoveryCodes() 0 3 1
A __construct() 0 15 2
A secretKey() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace PersonalGalaxy\Identity\Event\Identity;
5
6
use PersonalGalaxy\Identity\Entity\Identity\{
7
    Email,
8
    SecretKey,
9
    RecoveryCode,
10
};
11
use Innmind\Immutable\SetInterface;
12
13
final class TwoFactorAuthenticationWasEnabled
14
{
15
    private $email;
16
    private $secretKey;
17
    private $recoveryCodes;
18
19 8
    public function __construct(
20
        Email $email,
21
        SecretKey $secretKey,
22
        SetInterface $recoveryCodes
23
    ) {
24 8
        if ((string) $recoveryCodes->type() !== RecoveryCode::class) {
25 1
            throw new \TypeError(sprintf(
26 1
                'Argument 3 must be of type SetInterface<%s>',
27 1
                RecoveryCode::class
28
            ));
29
        }
30
31 7
        $this->email = $email;
32 7
        $this->secretKey = $secretKey;
33 7
        $this->recoveryCodes = $recoveryCodes;
34 7
    }
35
36 2
    public function email(): Email
37
    {
38 2
        return $this->email;
39
    }
40
41 2
    public function secretKey(): SecretKey
42
    {
43 2
        return $this->secretKey;
44
    }
45
46
    /**
47
     * @return SetInterface<RecoveryCode>
48
     */
49 4
    public function recoveryCodes(): SetInterface
50
    {
51 4
        return $this->recoveryCodes;
52
    }
53
}
54