| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function getUser(): AbstractUserViewModel |
||
| 38 | { |
||
| 39 | try { |
||
| 40 | $user = $this->authenticationService->getLoggedInUser(); |
||
| 41 | } catch (NoUserAuthenticatedException $e) { |
||
| 42 | return VisitorViewModel::construct(); |
||
| 43 | } |
||
| 44 | |||
| 45 | if ($user->isAdmin()) { |
||
| 46 | return AdminViewModel::constructFromEntity($user); |
||
| 47 | } |
||
| 48 | |||
| 49 | if ($user->isEditor()) { |
||
| 50 | return EditorViewModel::constructFromEntity($user); |
||
| 51 | } |
||
| 52 | |||
| 53 | throw new AppRuntimeException('Unknown user type, with roles: ' . json_encode($user->getRoles())); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |