ClientCertificate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInfoAttribute() 0 3 1
A dedicatedServers() 0 3 1
1
<?php
2
3
namespace Gameap\Models;
4
5
use Gameap\Services\Daemon\CertificateService;
6
use Illuminate\Database\Eloquent\Model;
7
8
/**
9
 * Class ClientCertificate
10
 * @package Gameap\Models
11
 *
12
 * @property int $id
13
 * @property string $fingerprint
14
 * @property string $expires
15
 * @property string $certificate
16
 * @property string $private_key
17
 * @property string $private_key_pass
18
 * @property array $info
19
 */
20
class ClientCertificate extends Model
21
{
22
    /**
23
     * @var bool
24
     */
25
    public $timestamps = false;
26
27
    /**
28
     * The attributes that are mass assignable.
29
     *
30
     * @var array
31
     */
32
    protected $fillable = [
33
        'fingerprint', 'expires', 'certificate', 'private_key', 'private_key_pass',
34
    ];
35
36
    /**
37
     * @var array
38
     */
39
    protected static $rules = [
40
        'certificate'      => 'required',
41
        'private_key'      => 'required',
42
        'private_key_pass' => '',
43
    ];
44
45
    /**
46
     * One to many relation
47
     *
48
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
49 3
     */
50
    public function dedicatedServers()
51 3
    {
52
        return $this->hasMany(DedicatedServer::class);
53
    }
54
55
    public function getInfoAttribute()
56
    {
57
        return CertificateService::certificateInfo($this->certificate);
58
    }
59
}
60