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

UserToken   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUser() 0 3 1
A user() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Models;
6
7
use Illuminate\Database\Eloquent\Model;
8
use Illuminate\Database\Eloquent\Relations\BelongsTo;
9
10
final class UserToken extends Model
11
{
12
    protected $fillable = [
13
        'token',
14
    ];
15
16 2
    public function user(): BelongsTo
17
    {
18 2
        return $this->belongsTo(User::class);
19
    }
20
21 2
    public function getUser(): User
22
    {
23 2
        return $this->getRelationValue('user');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getRelationValue('user') could return the type null which is incompatible with the type-hinted return App\Models\User. Consider adding an additional type-check to rule them out.
Loading history...
24
    }
25
}
26