| @@ 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, $aPassword, $userRoles); |
|
| 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. |
|
| @@ 167-180 (lines=14) @@ | ||
| 164 | * |
|
| 165 | * @return static |
|
| 166 | */ |
|
| 167 | public static function invite(UserId $anId, UserEmail $anEmail) |
|
| 168 | { |
|
| 169 | $user = new static($anId, $anEmail); |
|
| 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. |
|