| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.25 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 9 | public function getCurrentUser() |
|
| 32 | { |
||
| 33 | 9 | $token = $this->tokenStorage->getToken(); |
|
| 34 | |||
| 35 | 9 | if (null === $token) { |
|
| 36 | throw new \Exception('No token found.'); |
||
| 37 | } |
||
| 38 | |||
| 39 | 9 | $user = $token->getUser(); |
|
| 40 | |||
| 41 | 9 | if (null === $user || !$user instanceof User) { |
|
| 42 | throw new \Exception('No user found.'); |
||
| 43 | } |
||
| 44 | |||
| 45 | 9 | return $user; |
|
| 46 | } |
||
| 48 |