Completed
Push — development ( 2fad51...a387f8 )
by Claudio
02:44
created

Country   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 56
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A store() 0 7 1
A getUniqueIdAttribute() 0 4 1
1
<?php
2
3
namespace App\Models;
4
5
/**
6
 * Class Country
7
 * @property mixed countryCode
8
 * @property mixed uniqueId
9
 * @package App\Models
10
 */
11
class Country extends ChocolateyModel
12
{
13
    /**
14
     * Disable Timestamps
15
     *
16
     * @var bool
17
     */
18
    public $timestamps = false;
19
20
    /**
21
     * The table associated with the model.
22
     *
23
     * @var string
24
     */
25
    protected $table = 'chocolatey_shop_countries';
26
27
    /**
28
     * The Appender(s) of the Model
29
     *
30
     * @var array
31
     */
32
    protected $appends = [
33
        'uniqueId'
34
    ];
35
36
    /**
37
     * Primary Key of the Table
38
     *
39
     * @var string
40
     */
41
    protected $primaryKey = 'id';
42
43
    /**
44
     * Store an Shop Country
45
     * @param string $countryCode
46
     * @param string $name
47
     * @return Country
48
     */
49
    public function store(string $countryCode, string $name): Country
50
    {
51
        $this->attributes['countryCode'] = $countryCode;
52
        $this->attributes['name'] = $name;
53
54
        return $this;
55
    }
56
57
    /**
58
     * Get Unique Id
59
     *
60
     * @return int
61
     */
62
    public function getUniqueIdAttribute(): int
63
    {
64
        return $this->attributes['id'];
65
    }
66
}
67