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