User   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 38
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getNameAttribute() 0 7 2
1
<?php
2
3
use Illuminate\Auth\UserTrait;
4
use Illuminate\Auth\UserInterface;
5
use Illuminate\Auth\Reminders\RemindableTrait;
6
use Illuminate\Auth\Reminders\RemindableInterface;
7
8
/**
9
 * User
10
 *
11
 * @property-read mixed $name
12
 * @property integer $id
13
 * @property string $username
14
 * @property string $displayname
15
 * @property string $email
16
 * @property boolean $admin
17
 * @property string $remember_token
18
 * @property \Carbon\Carbon $created_at
19
 * @property \Carbon\Carbon $updated_at
20
 * @method static \Illuminate\Database\Query\Builder|\User whereId($value)
21
 * @method static \Illuminate\Database\Query\Builder|\User whereUsername($value)
22
 * @method static \Illuminate\Database\Query\Builder|\User whereDisplayname($value)
23
 * @method static \Illuminate\Database\Query\Builder|\User whereEmail($value)
24
 * @method static \Illuminate\Database\Query\Builder|\User whereAdmin($value)
25
 * @method static \Illuminate\Database\Query\Builder|\User whereRememberToken($value)
26
 * @method static \Illuminate\Database\Query\Builder|\User whereCreatedAt($value)
27
 * @method static \Illuminate\Database\Query\Builder|\User whereUpdatedAt($value)
28
 */
29
class User extends Eloquent implements UserInterface, RemindableInterface {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
30
31
	use UserTrait, RemindableTrait;
32
33
	/**
34
	 * The database table used by the model.
35
	 *
36
	 * @var string
37
	 */
38
	protected $table = 'users';
39
40
	/**
41
	 * The attributes excluded from the model's JSON form.
42
	 *
43
	 * @var array
44
	 */
45
	protected $hidden = ['password', 'remember_token'];
46
47
	/**
48
	 * Get auth password
49
	 *
50
	 * Overwritten for mozilla persona usage.
51
	 */
52
	public function getAuthPassword() {
53
		return Hash::make('moz:persona');
54
	}
55
56
	/**
57
	 * Get user's preferred name (username or displayname)
58
	 */
59 5
	public function getNameAttribute() {
60 5
		if ($this->displayname) {
61 2
			return $this->displayname;
62
		}
63
64 3
		return $this->username;
65
	}
66
}
67