@@ 145-157 (lines=13) @@ | ||
142 | * |
|
143 | * @return static |
|
144 | */ |
|
145 | public static function signUp(UserId $anId, UserEmail $anEmail, UserPassword $aPassword, array $userRoles) |
|
146 | { |
|
147 | $user = new static($anId, $anEmail, $userRoles, $aPassword); |
|
148 | $user->publish( |
|
149 | new UserRegistered( |
|
150 | $user->id(), |
|
151 | $user->email(), |
|
152 | $user->confirmationToken() |
|
153 | ) |
|
154 | ); |
|
155 | ||
156 | return $user; |
|
157 | } |
|
158 | ||
159 | /** |
|
160 | * Invites user. |
|
@@ 168-181 (lines=14) @@ | ||
165 | * |
|
166 | * @return static |
|
167 | */ |
|
168 | public static function invite(UserId $anId, UserEmail $anEmail, array $userRoles) |
|
169 | { |
|
170 | $user = new static($anId, $anEmail, $userRoles); |
|
171 | $user->invitationToken = new UserToken(); |
|
172 | $user->publish( |
|
173 | new UserInvited( |
|
174 | $user->id(), |
|
175 | $user->email(), |
|
176 | $user->invitationToken() |
|
177 | ) |
|
178 | ); |
|
179 | ||
180 | return $user; |
|
181 | } |
|
182 | ||
183 | /** |
|
184 | * Gets the id. |