Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
66.67% |
6 / 9 |
|
66.67% |
6 / 9 |
CRAP | |
0.00% |
0 / 1 |
LoginAttempt | |
66.67% |
6 / 9 |
|
66.67% |
6 / 9 |
12.00 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getIp | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setIp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getEmail | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setEmail | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAttempts | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAttempts | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace App\Domain\User\Model; |
4 | |
5 | use Ramsey\Uuid\Uuid; |
6 | use Ramsey\Uuid\UuidInterface; |
7 | |
8 | class LoginAttempt |
9 | { |
10 | /** |
11 | * @var UuidInterface |
12 | */ |
13 | private $id; |
14 | |
15 | /** |
16 | * @var string|null |
17 | */ |
18 | private $ip; |
19 | |
20 | /** |
21 | * @var string|null |
22 | */ |
23 | private $email; |
24 | |
25 | /** |
26 | * @var int|null |
27 | */ |
28 | private $attempts; |
29 | |
30 | public function __construct() |
31 | { |
32 | $this->id = Uuid::uuid4(); |
33 | } |
34 | |
35 | public function __toString() |
36 | { |
37 | return $this->ip . ' - ' . $this->attempts; |
38 | } |
39 | |
40 | public function getId(): UuidInterface |
41 | { |
42 | return $this->id; |
43 | } |
44 | |
45 | public function getIp(): ?string |
46 | { |
47 | return $this->ip; |
48 | } |
49 | |
50 | public function setIp(?string $ip): void |
51 | { |
52 | $this->ip = $ip; |
53 | } |
54 | |
55 | public function getEmail(): ?string |
56 | { |
57 | return $this->email; |
58 | } |
59 | |
60 | public function setEmail(?string $email): void |
61 | { |
62 | $this->email = $email; |
63 | } |
64 | |
65 | public function getAttempts(): ?int |
66 | { |
67 | return $this->attempts; |
68 | } |
69 | |
70 | public function setAttempts(?int $attempts): void |
71 | { |
72 | $this->attempts = $attempts; |
73 | } |
74 | } |