Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3.2098 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | 7 | public function getUser(): LoggedInUser |
|
20 | { |
||
21 | 7 | $user = $this->security->getUser(); |
|
22 | 7 | if ($user == null) { |
|
23 | throw new \RuntimeException("You are not logged in!"); |
||
24 | } |
||
25 | 7 | if ($user instanceof LoggedInUser) { |
|
26 | 7 | return $user; |
|
27 | } |
||
28 | throw new \RuntimeException("Unsupported User Class: " . $user::class); |
||
29 | } |
||
30 | } |