Passed
Pull Request — master (#201)
by
unknown
10:40
created

Locale::getThousandsSeparator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Locale Entity.
4
 *
5
 * @package App\Entities\Locale
6
 *
7
 * @author    Nick Menke <[email protected]>
8
 * @copyright 2018-2020 Nick Menke
9
 *
10
 * @link https://github.com/nlmenke/vertebrae
11
 */
12
13
declare(strict_types=1);
14
15
namespace App\Entities\Locale;
16
17
use App\Entities\AbstractEntity;
18
use App\Entities\Country\Country;
19
use App\Entities\Language\Language;
20
use App\Entities\Script\Script;
21
use Illuminate\Database\Eloquent\Relations\BelongsTo;
22
use Illuminate\Database\Eloquent\SoftDeletes;
23
24
/**
25
 * The Locale entity class.
26
 *
27
 * This class contains any functions required to access and manipulate locale
28
 * models.
29
 *
30
 * @since x.x.x introduced
31
 */
32
class Locale extends AbstractEntity
33
{
34
    use SoftDeletes;
35
36
    /**
37
     * The attributes that are mass assignable.
38
     *
39
     * @var array
40
     */
41
    protected $fillable = [
42
        'country_id',
43
        'language_id',
44
        'script_id',
45
        'code',
46
        'native',
47
        'currency_symbol_first',
48
        'decimal_mark',
49
        'thousands_separator',
50
        'active',
51
    ];
52
53
    /**
54
     * The country relationship instance.
55
     *
56
     * @return BelongsTo
57
     */
58 4
    public function country(): BelongsTo
59
    {
60 4
        return $this->belongsTo(Country::class);
61
    }
62
63
    /**
64
     * Get the code attribute.
65
     *
66
     * @return string
67
     */
68
    public function getCode(): string
69
    {
70
        return $this->getAttribute('code');
71
    }
72
73
    /**
74
     * Get the country attribute.
75
     *
76
     * @return Country|null
77
     */
78
    public function getCountry(): ?Country
79
    {
80
        return $this->getAttribute('country');
81
    }
82
83
    /**
84
     * Get the currency_symbol_first attribute.
85
     *
86
     * @return bool
87
     */
88
    public function getCurrencySymbolFirst(): bool
89
    {
90
        return $this->getAttribute('currency_symbol_first');
91
    }
92
93
    /**
94
     * Get the decimal_mark attribute.
95
     *
96
     * @return string
97
     */
98
    public function getDecimalMark(): string
99
    {
100
        return $this->getAttribute('decimal_mark');
101
    }
102
103
    /**
104
     * Get the language attribute.
105
     *
106
     * @return Language
107
     */
108
    public function getLanguage(): Language
109
    {
110
        return $this->getAttribute('language');
111
    }
112
113
    /**
114
     * Get the native attribute.
115
     *
116
     * @return string
117
     */
118
    public function getNative(): string
119
    {
120
        return $this->getAttribute('native');
121
    }
122
123
    /**
124
     * Get the script attribute.
125
     *
126
     * @return Script
127
     */
128
    public function getScript(): Script
129
    {
130
        return $this->getAttribute('script');
131
    }
132
133
    /**
134
     * Get the thousands_separator attribute.
135
     *
136
     * @return string
137
     */
138
    public function getThousandsSeparator(): string
139
    {
140
        return $this->getAttribute('thousands_separator');
141
    }
142
143
    /**
144
     * Check whether the locale is active.
145
     *
146
     * @return bool
147
     */
148
    public function isActive(): bool
149
    {
150
        return $this->getAttribute('active');
151
    }
152
153
    /**
154
     * The language relationship instance.
155
     *
156
     * @return BelongsTo
157
     */
158 4
    public function language(): BelongsTo
159
    {
160 4
        return $this->belongsTo(Language::class);
161
    }
162
163
    /**
164
     * The script relationship instance.
165
     *
166
     * @return BelongsTo
167
     */
168 4
    public function script(): BelongsTo
169
    {
170 4
        return $this->belongsTo(Script::class);
171
    }
172
}
173