| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.128 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | 9 | public function getUser(Request $request = null) |
|
| 46 | { |
||
| 47 | 9 | if (!$request) { |
|
| 48 | return; |
||
| 49 | } |
||
| 50 | 9 | $token = base64_decode($request->getHeader('Authorization')); |
|
| 51 | 9 | if (!$token) { |
|
| 52 | 4 | return; |
|
| 53 | } |
||
| 54 | 5 | if (!strpos($token, ':')) { |
|
| 55 | return; |
||
| 56 | } |
||
| 57 | 5 | list($name, $password) = explode(':', $token); |
|
| 58 | |||
| 59 | 5 | return $this->repository->findByNameAndPassword($name, $password); |
|
| 60 | } |
||
| 61 | } |
||
| 62 |