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

TwoFactorAuthenticationWasEnabled::email()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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