Country   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A store() 0 8 1
A getUniqueIdAttribute() 0 4 1
1
<?php
2
3
namespace App\Models;
4
5
/**
6
 * Class Country.
7
 *
8
 * @property mixed countryCode
9
 * @property mixed uniqueId
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 = ['uniqueId'];
33
34
    /**
35
     * Primary Key of the Table.
36
     *
37
     * @var string
38
     */
39
    protected $primaryKey = 'id';
40
41
    /**
42
     * Store an Shop Country.
43
     *
44
     * @param string $countryCode
45
     * @param string $name
46
     *
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
        $this->timestamps = false;
54
55
        return $this;
56
    }
57
58
    /**
59
     * Get Unique Id.
60
     *
61
     * @return int
62
     */
63
    public function getUniqueIdAttribute(): int
64
    {
65
        return $this->attributes['id'];
66
    }
67
}
68