| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function provide(): ShopUserInterface |
||
| 30 | { |
||
| 31 | $token = $this->tokenStorage->getToken(); |
||
| 32 | |||
| 33 | if (null === $token) { |
||
| 34 | throw new TokenNotFoundException('No token found.'); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** @var ShopUserInterface|null $user */ |
||
| 38 | $user = $token->getUser(); |
||
| 39 | |||
| 40 | if (!$user instanceof ShopUserInterface) { |
||
| 41 | throw new TokenNotFoundException('No logged in user.'); |
||
| 42 | } |
||
| 43 | |||
| 44 | return $user; |
||
| 45 | } |
||
| 46 | |||
| 54 |