| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function get() |
||
| 38 | { |
||
| 39 | $auth = new Auth(); |
||
| 40 | $token = $this->tokenExtractor->extract(); |
||
| 41 | if (!$token) { |
||
| 42 | return $auth; |
||
| 43 | } |
||
| 44 | |||
| 45 | try { |
||
| 46 | $data = $this->jwtEncoder->decode($token); |
||
| 47 | } catch (InvalidTokenException $e) { |
||
| 48 | $auth->isLogin = false; |
||
| 49 | |||
| 50 | return $auth; |
||
| 51 | } |
||
| 52 | |||
| 53 | $auth->userid = $data['userid']; |
||
| 54 | $auth->username = $data['username']; |
||
| 55 | $auth->isLogin = true; |
||
| 56 | |||
| 57 | return $auth; |
||
| 58 | } |
||
| 59 | } |
||
| 60 |