| Conditions | 6 |
| Paths | 6 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public static function retrieveById(int $id): User |
||
| 31 | { |
||
| 32 | $repository = new UserRepository(); |
||
| 33 | |||
| 34 | $user = $repository->fetchUserModelById($id); |
||
| 35 | if (!$user) { |
||
| 36 | throw new UserException("User {$id} not found."); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $user; |
||
| 40 | } |
||
| 41 | |||
| 42 | public static function retrieveByEmail(string $email): User |
||
| 43 | { |
||
| 44 | $repository = new UserRepository(); |
||
| 45 | |||
| 46 | $user = $repository->fetchUserModelByEmail($email); |
||
| 47 | if (!$user) { |
||
| 48 | throw new UserException("User with email = {$email} not found."); |
||
| 49 | } |
||
| 50 | |||
| 51 | return $user; |
||
| 52 | } |
||
| 53 | } |
||
| 54 |