| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function getCurrentAccount(): ?UserAccount |
||
| 30 | { |
||
| 31 | $token = $this->tokenStorage->getToken(); |
||
| 32 | if (null === $token) { |
||
| 33 | throw new \InvalidArgumentException('Unable to retrieve the current user.'); |
||
| 34 | } |
||
| 35 | |||
| 36 | $user = $token->getUser(); |
||
| 37 | if (!$user instanceof UserAccount) { |
||
| 38 | throw new \InvalidArgumentException('Unable to retrieve the current user.'); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $user; |
||
| 42 | } |
||
| 43 | } |
||
| 44 |