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

IdentityProvider   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 25
dl 0
loc 105
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A idpX509cert() 0 3 1
A idpUuid() 0 3 1
A idpNameIdFormat() 0 3 1
A sessions() 0 3 1
A tenant() 0 3 1
A idpLoginUrl() 0 3 1
A idpEntityId() 0 3 1
A idpLogoutUrl() 0 3 1
1
<?php
2
3
namespace Slides\Saml2\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\HasMany;
7
use Illuminate\Database\Eloquent\Relations\MorphTo;
8
use Illuminate\Database\Eloquent\SoftDeletes;
9
use Slides\Saml2\Contracts\IdentityProvidable;
10
11
/**
12
 * @property int $id
13
 * @property string $uuid
14
 * @property string $key
15
 * @property string $idp_entity_id
16
 * @property string $idp_login_url
17
 * @property string $idp_logout_url
18
 * @property string $idp_x509_cert
19
 * @property string $relay_state_url
20
 * @property string $name_id_format
21
 * @property int|null $owner_id
22
 * @property string|null $owner_type
23
 * @property array $metadata
24
 * @property \Carbon\Carbon $created_at
25
 * @property \Carbon\Carbon $updated_at
26
 * @property \Carbon\Carbon $deleted_at
27
 *
28
 * @property-read \Illuminate\Database\Eloquent\Model|null $tenant
29
 * @property-read \Illuminate\Database\Eloquent\Model $sessions
30
 */
31
class IdentityProvider extends Model implements IdentityProvidable
32
{
33
    use SoftDeletes;
34
35
    /**
36
     * The database table used by the model.
37
     *
38
     * @var string
39
     */
40
    protected $table = 'saml2_identity_providers';
41
42
    /**
43
     * The attributes that are mass assignable.
44
     *
45
     * @var array
46
     */
47
    protected $fillable = [
48
        'uuid',
49
        'key',
50
        'idp_entity_id',
51
        'idp_login_url',
52
        'idp_logout_url',
53
        'idp_x509_cert',
54
        'relay_state_url',
55
        'name_id_format',
56
        'tenant_id',
57
        'tenant_type',
58
        'metadata'
59
    ];
60
61
    /**
62
     * The attributes that should be cast to native types.
63
     *
64
     * @var array
65
     */
66
    protected $casts = [
67
        'metadata' => 'array'
68
    ];
69
70
    /**
71
     * @return string
72
     */
73
    public function idpUuid(): string
74
    {
75
        return $this->uuid;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function idpEntityId(): string
82
    {
83
        return $this->idp_entity_id;
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function idpLoginUrl(): string
90
    {
91
        return $this->idp_login_url;
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function idpLogoutUrl(): string
98
    {
99
        return $this->idp_logout_url;
100
    }
101
102
    /**
103
     * @return string
104
     */
105
    public function idpX509cert(): ?string
106
    {
107
        return $this->idp_x509_cert;
108
    }
109
110
    /**
111
     * @return string
112
     */
113
    public function idpNameIdFormat(): string
114
    {
115
        return $this->name_id_format;
116
    }
117
118
    /**
119
     * The tenant model.
120
     *
121
     * @return MorphTo
122
     */
123
    public function tenant(): MorphTo
124
    {
125
        return $this->morphTo();
126
    }
127
128
    /**
129
     * The sessions of the tenant.
130
     *
131
     * @return HasMany
132
     */
133
    public function sessions(): HasMany
134
    {
135
        return $this->hasMany(Session::class);
136
    }
137
}
138