| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function loadUserByApiKey(string $apiKey): UserInterface |
||
| 33 | { |
||
| 34 | try { |
||
| 35 | $key = $this->storage->get($apiKey); |
||
| 36 | } catch (KeyNotFoundException $e) { |
||
| 37 | throw new InvalidApiKeyException(); |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($key->expired()) { |
||
| 41 | throw new InvalidApiKeyException(); |
||
| 42 | } |
||
| 43 | |||
| 44 | return $this->loadUserByUsername($key->username()); |
||
| 45 | } |
||
| 55 |