Test Failed
Pull Request — master (#688)
by
unknown
06:18
created

UserResolver   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 15
ccs 5
cts 6
cp 0.8333
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 10 3
1
<?php
2
3
namespace OwenIt\Auditing\Resolvers;
4
5
use Illuminate\Support\Facades\Auth;
6
use Illuminate\Support\Facades\Config;
7
8
class UserResolver implements \OwenIt\Auditing\Contracts\UserResolver
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 14
    public static function resolve()
14
    {
15 14
        $guards = Config::get('audit.user.guards', [
16 14
            'web',
17
            'api',
18
        ]);
19
20 14
        foreach ($guards as $guard) {
21 14
            if (Auth::guard($guard)->check()) {
22
                return Auth::guard($guard)->user();
23
            }
24
        }
25 14
    }
26
}
27