Test Failed
Pull Request — master (#88)
by Artem
04:05
created

Session::user()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Slides\Saml2\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\BelongsTo;
7
use Illuminate\Database\Eloquent\Relations\HasOne;
8
use Illuminate\Foundation\Auth\User as Authenticatable;
0 ignored issues
show
Bug introduced by
The type Illuminate\Foundation\Auth\User was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * @property int $id
12
 * @property int $idp_id
13
 * @property int|null $user_id
14
 * @property array $payload
15
 * @property \Carbon\Carbon $created_at
16
 *
17
 * @property-read IdentityProvider|null $tenant
18
 * @property-read Authenticatable|Model $user
19
 */
20
class Session extends Model
21
{
22
    /**
23
     * The database table used by the model.
24
     *
25
     * @var string
26
     */
27
    protected $table = 'saml2_sessions';
28
29
    /**
30
     * The attributes that are mass assignable.
31
     *
32
     * @var array
33
     */
34
    protected $fillable = [
35
        'idp_id',
36
        'payload',
37
    ];
38
39
    /**
40
     * The attributes that should be cast to native types.
41
     *
42
     * @var array
43
     */
44
    protected $casts = [
45
        'payload' => 'array'
46
    ];
47
48
    /**
49
     * The user model.
50
     *
51
     * @return BelongsTo
52
     */
53
    public function user(): BelongsTo
54
    {
55
        return $this->belongsTo(config('saml2.auth.userModel'));
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

55
        return $this->belongsTo(/** @scrutinizer ignore-call */ config('saml2.auth.userModel'));
Loading history...
56
    }
57
58
    /**
59
     * The tenant model (identity provider).
60
     *
61
     * @return HasOne
62
     */
63
    public function tenant(): HasOne
64
    {
65
        return $this->hasOne(config('saml2.idpModel'), 'id', 'idp_id');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

65
        return $this->hasOne(/** @scrutinizer ignore-call */ config('saml2.idpModel'), 'id', 'idp_id');
Loading history...
66
    }
67
}
68