| Conditions | 3 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function register() |
||
| 12 | { |
||
| 13 | $this->app->bind('Bludata\Lumen\Authentication\JWT\Interfaces\JWTInterface', 'Bludata\Lumen\Authentication\JWT\Libs\JWT'); |
||
|
|
|||
| 14 | |||
| 15 | $this->app['auth']->viaRequest( |
||
| 16 | 'api', function ($request) { |
||
| 17 | if ($token = $request->header('authorization')) { |
||
| 18 | $auth = app('Bludata\Lumen\Authentication\JWT\Interfaces\AuthRepositoryInterface'); |
||
| 19 | |||
| 20 | try { |
||
| 21 | $user = $auth->getUserLoggedByToken($token); |
||
| 22 | } catch (Exception $e) { |
||
| 23 | abort(401, $e->getMessage()); |
||
| 24 | } |
||
| 25 | |||
| 26 | return $user; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | ); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.