Passed
Push — master ( 2a90e7...a622eb )
by Ron
02:27 queued 14s
created

GetUserDetails::getUserData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Domains\Users;
4
5
use Illuminate\Support\Facades\Log;
6
use Illuminate\Support\Facades\Auth;
7
8
use App\User;
9
use App\UserSettings;
10
11
class GetUserDetails
12
{
13
    protected $userID;
14
15 2
    public function __construct($userID = null)
16
    {
17 2
        $this->userID = $userID ? $userID : Auth::user()->user_id;
18 2
    }
19
20 2
    public function getUserData()
21
    {
22 2
        $userData = User::find($this->userID)->makeVisible('username');
23 2
        Log::debug('User Data gathered for User ID '.$this->userID.'.  Gathered Data - ', array($userData));
24
25 2
        return $userData;
26
    }
27
28 2
    public function getUserSettings()
29
    {
30 2
        $userSett = UserSettings::where('user_id', $this->userID)->first();
31 2
        Log::debug('User Settings gathered for User ID '.$this->userID.'.  Gathered Data - ', array($userSett));
32
33 2
        return $userSett;
34
    }
35
}
36