Passed
Push — master ( cfceb1...4bf73b )
by Koen
09:48
created

User   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A tokens() 0 3 1
A setCurrentToken() 0 3 1
A getCurrentToken() 0 3 1
A getEmail() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Models;
6
7
use App\Events\User\Deleting;
8
use Illuminate\Database\Eloquent\Relations\HasMany;
9
use Illuminate\Foundation\Auth\User as Authenticatable;
10
use Illuminate\Notifications\Notifiable;
11
12
final class User extends Authenticatable
13
{
14
    use Notifiable;
0 ignored issues
show
Bug introduced by
The trait Illuminate\Notifications\Notifiable requires the property $email which is not provided by App\Models\User.
Loading history...
15
16
    protected $fillable = [
17
        'name', 'email', 'password',
18
    ];
19
20
    protected $dispatchesEvents = [
21
        'deleting' => Deleting::class,
22
    ];
23
24
    private ?UserToken $currentToken = null;
25
26 6
    public function tokens(): HasMany
27
    {
28 6
        return $this->hasMany(UserToken::class);
29
    }
30
31 2
    public function setCurrentToken(UserToken $token)
32
    {
33 2
        $this->currentToken = $token;
34 2
    }
35
36 1
    public function getCurrentToken()
37
    {
38 1
        return $this->currentToken;
39
    }
40
41 1
    public function getEmail(): string
42
    {
43 1
        return $this->getAttributeValue('email');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getAttributeValue('email') could return the type boolean|null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
44
    }
45
}
46