1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NStack\Models; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Continent |
7
|
|
|
* |
8
|
|
|
* @package NStack\Models |
9
|
|
|
* @author Casper Rasmussen <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class Language extends Model |
12
|
|
|
{ |
13
|
|
|
/** @var int */ |
14
|
|
|
protected $id; |
15
|
|
|
|
16
|
|
|
/** @var string */ |
17
|
|
|
protected $name; |
18
|
|
|
|
19
|
|
|
/** @var string */ |
20
|
|
|
protected $locale; |
21
|
|
|
|
22
|
|
|
/** @var string */ |
23
|
|
|
protected $direction; |
24
|
|
|
|
25
|
|
|
/** @var bool */ |
26
|
|
|
protected $isDefault; |
27
|
|
|
|
28
|
|
|
/** @var bool */ |
29
|
|
|
protected $isBestFit; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* parse |
33
|
|
|
* |
34
|
|
|
* @param array $data |
35
|
|
|
* @author Casper Rasmussen <[email protected]> |
36
|
|
|
*/ |
37
|
5 |
|
public function parse(array $data) |
38
|
|
|
{ |
39
|
5 |
|
$this->id = (int)$data['id']; |
40
|
5 |
|
$this->name = (string)$data['name']; |
41
|
5 |
|
$this->locale = (string)$data['locale']; |
42
|
5 |
|
$this->direction = (string)$data['direction']; |
43
|
5 |
|
$this->isDefault = (bool)$data['is_default']; |
44
|
5 |
|
$this->isBestFit = (bool)$data['is_best_fit']; |
45
|
5 |
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* toArray |
49
|
|
|
* |
50
|
|
|
* @return array |
51
|
|
|
* @author Casper Rasmussen <[email protected]> |
52
|
|
|
*/ |
53
|
|
|
public function toArray(): array |
54
|
|
|
{ |
55
|
|
|
return [ |
56
|
|
|
'id' => $this->id, |
57
|
|
|
'name' => $this->name, |
58
|
|
|
'locale' => $this->locale, |
59
|
|
|
'direction' => $this->direction, |
60
|
|
|
'is_default' => $this->isDefault, |
61
|
|
|
'is_best_fit' => $this->isBestFit, |
62
|
|
|
]; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return int |
67
|
|
|
* @author Casper Rasmussen <[email protected]> |
68
|
|
|
*/ |
69
|
|
|
public function getId(): int |
70
|
|
|
{ |
71
|
|
|
return $this->id; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return string |
76
|
|
|
* @author Casper Rasmussen <[email protected]> |
77
|
|
|
*/ |
78
|
|
|
public function getName(): string |
79
|
|
|
{ |
80
|
|
|
return $this->name; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return string |
85
|
|
|
* @author Casper Rasmussen <[email protected]> |
86
|
|
|
*/ |
87
|
|
|
public function getLocale(): string |
88
|
|
|
{ |
89
|
|
|
return $this->locale; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return string |
94
|
|
|
* @author Casper Rasmussen <[email protected]> |
95
|
|
|
*/ |
96
|
|
|
public function getDirection(): string |
97
|
|
|
{ |
98
|
|
|
return $this->direction; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return bool |
103
|
|
|
* @author Casper Rasmussen <[email protected]> |
104
|
|
|
*/ |
105
|
|
|
public function isDefault(): bool |
106
|
|
|
{ |
107
|
|
|
return $this->isDefault; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return bool |
112
|
|
|
* @author Casper Rasmussen <[email protected]> |
113
|
|
|
*/ |
114
|
|
|
public function isBestFit(): bool |
115
|
|
|
{ |
116
|
|
|
return $this->isBestFit; |
117
|
|
|
} |
118
|
|
|
} |