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