Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.432 |
Changes | 4 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
13 | 48 | public static function resolve() |
|
14 | { |
||
15 | 48 | $guards = Config::get('audit.user.guards', [ |
|
16 | 48 | \config('auth.defaults.guard') |
|
17 | ]); |
||
18 | |||
19 | 48 | foreach ($guards as $guard) { |
|
20 | try { |
||
21 | 48 | $authenticated = Auth::guard($guard)->check(); |
|
22 | } catch (\Exception $exception) { |
||
23 | continue; |
||
24 | } |
||
25 | |||
26 | 48 | if (true === $authenticated) { |
|
27 | return Auth::guard($guard)->user(); |
||
|
|||
28 | } |
||
29 | } |
||
30 | |||
31 | 48 | return null; |
|
32 | } |
||
34 |