| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function setUserFromSecurityTokenStorage(TokenStorageInterface $tokenStorage) |
||
| 13 | { |
||
| 14 | if (($token = $tokenStorage->getToken()) === null) { |
||
| 15 | throw new \InvalidArgumentException('Token missing'); |
||
| 16 | } |
||
| 17 | |||
| 18 | if (!(($user = $token->getUser()) instanceof User)) { |
||
| 19 | throw new \InvalidArgumentException('Invalid user'); |
||
| 20 | } |
||
| 21 | |||
| 22 | $this->authenticatedUser = $user; |
||
| 23 | } |
||
| 24 | } |
||
| 25 |