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

UserToken::user()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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