Guard   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getGuardClassName() 0 14 3
1
<?php
2
3
namespace Hamidrezaniazi\Laramist;
4
5
use Illuminate\Support\Facades\Config;
6
7
class Guard
8
{
9
    /**
10
     * Return guard model class name.
11
     *
12
     * @return string
13
     */
14
    public static function getGuardClassName(): string
15
    {
16
        $guard = Config::get('auth.defaults.guard');
17
        $guard = collect(config('auth.guards'))
18
            ->map(function ($guard) {
19
                if (! isset($guard['provider'])) {
20
                    return;
21
                }
22
23
                return config("auth.providers.{$guard['provider']}.model");
24
            })->get($guard);
25
26
        return class_exists($guard) ? $guard : $guard = \Hamidrezaniazi\Laramist\Tests\Model\User::class;
27
    }
28
}
29