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

GetUserDetails   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 23
ccs 11
cts 11
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getUserData() 0 6 1
A getUserSettings() 0 6 1
A __construct() 0 3 2
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