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