Total Complexity | 8 |
Total Lines | 110 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
11 | class User |
||
12 | { |
||
13 | /** |
||
14 | * @var UuidInterface |
||
15 | */ |
||
16 | private $id; |
||
17 | |||
18 | /** |
||
19 | * @var Email |
||
20 | */ |
||
21 | private $email; |
||
22 | |||
23 | /** |
||
24 | * @var NotEmptyString |
||
25 | */ |
||
26 | private $lastName; |
||
27 | |||
28 | /** |
||
29 | * @var NotEmptyString |
||
30 | */ |
||
31 | private $firstName; |
||
32 | |||
33 | /** |
||
34 | * @var Role |
||
35 | */ |
||
36 | private $role; |
||
37 | |||
38 | /** |
||
39 | * @var Password|null |
||
40 | */ |
||
41 | private $password; |
||
42 | |||
43 | /** |
||
44 | * @param UuidInterface $id |
||
45 | * @param Email $email |
||
46 | * @param NotEmptyString $lastName |
||
47 | * @param NotEmptyString $firstName |
||
48 | * @param Role $role |
||
49 | */ |
||
50 | public function __construct( |
||
51 | UuidInterface $id, |
||
52 | Email $email, |
||
53 | NotEmptyString $lastName, |
||
54 | NotEmptyString $firstName, |
||
55 | Role $role |
||
56 | ) { |
||
57 | $this->id = $id; |
||
58 | $this->email = $email; |
||
59 | $this->lastName = $lastName; |
||
60 | $this->firstName = $firstName; |
||
61 | $this->role = $role; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return UuidInterface |
||
66 | */ |
||
67 | public function getId(): UuidInterface |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @return Email |
||
74 | */ |
||
75 | public function getEmail(): Email |
||
76 | { |
||
77 | return $this->email; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @return NotEmptyString |
||
82 | */ |
||
83 | public function getLastName(): NotEmptyString |
||
84 | { |
||
85 | return $this->lastName; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @return NotEmptyString |
||
90 | */ |
||
91 | public function getFirstName(): NotEmptyString |
||
92 | { |
||
93 | return $this->firstName; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @return Role |
||
98 | */ |
||
99 | public function getRole(): Role |
||
100 | { |
||
101 | return $this->role; |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * @param Password $password |
||
106 | * @return User |
||
107 | */ |
||
108 | public function withPassword(Password $password): User |
||
109 | { |
||
110 | $c = clone $this; |
||
111 | $c->password = $password; |
||
112 | return $c; |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * @return Password|null |
||
117 | */ |
||
118 | public function getPassword(): ?Password |
||
121 | } |
||
122 | } |
||
123 |