Completed
Push — master ( d98470...f9014f )
by Antonio Carlos
17:20 queued 15:58
created

Auth   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 40
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAuth() 0 13 3
A getUser() 0 4 1
config() 0 1 ?
1
<?php
2
3
namespace PragmaRX\Google2FALaravel\Support;
4
5
trait Auth
6
{
7
    /**
8
     * The auth instance.
9
     *
10
     * @var
11
     */
12
    protected $auth;
13
14
    /**
15
     * Get or make an auth instance.
16
     *
17
     * @return \Illuminate\Foundation\Application|mixed
18
     */
19 10
    protected function getAuth()
20
    {
21 10
        if (is_null($this->auth)) {
22 10
            $this->auth = app($this->config('auth'));
23
24 10
            if(!empty($this->config('guard')))
25
            {
26
                $this->auth = app($this->config('auth'))->guard($this->config('guard'));
27
            }
28
        }
29
30 10
        return $this->auth;
31
    }
32
33
    /**
34
     * Get the current user.
35
     *
36
     * @return mixed
37
     */
38 10
    protected function getUser()
39
    {
40 10
        return $this->getAuth()->user();
41
    }
42
43
    abstract protected function config($string, $children = []);
44
}
45