Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
20 | public function handle(Logout $event): void |
||
21 | { |
||
22 | $storeInCookie = config('google2fa.store_in_cookie', false); |
||
23 | if (false === $storeInCookie) { |
||
24 | return; |
||
25 | } |
||
26 | // delete token from DB, making cookie worthless. |
||
27 | $cookieName = config('google2fa.cookie_name', 'google2fa_token'); |
||
28 | $token = request()->cookies->get($cookieName); |
||
29 | |||
30 | // check DB for token. |
||
31 | try { |
||
32 | DB::table('2fa_tokens') |
||
33 | ->where('token', $token) |
||
34 | ->where('user_id', $event->user->id)->delete(); |
||
|
|||
35 | } catch (QueryException $e) { |
||
36 | Log::error('Could not delete user token from database.'); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | } |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: