Guard::getGuardClassName()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 2
nc 1
nop 0
1
<?php
2
3
namespace Hamidrezaniazi\Upolo;
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
18
        return collect(config('auth.guards'))
19
            ->map(function ($guard) {
20
                if (! isset($guard['provider'])) {
21
                    return;
22
                }
23
24
                return config("auth.providers.{$guard['provider']}.model");
25
            })->get($guard);
26
    }
27
}
28