Completed
Push — master ( 21c015...b85bcf )
by Antonio Carlos
07:14 queued 05:46
created

Auth::getAuth()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
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 8
    protected function getAuth()
20
    {
21 8
        if (is_null($this->auth)) {
22 8
            $this->auth = app($this->config('auth'));
23
        }
24
25 8
        return $this->auth;
26
    }
27
28
    /**
29
     * Get the current user.
30
     *
31
     * @return mixed
32
     */
33 8
    protected function getUser()
34
    {
35 8
        return $this->getAuth()->user();
36
    }
37
38
    abstract public function config($string, $children = []);
39
}
40