1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace FAPI\Localise\Model\Asset; |
4
|
|
|
|
5
|
|
|
use FAPI\Localise\Model\CreatableFromArray; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @author Tobias Nyholm <[email protected]> |
9
|
|
|
*/ |
10
|
|
|
class Asset implements CreatableFromArray |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var string |
14
|
|
|
*/ |
15
|
|
|
private $id; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
private $type; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $name; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $context; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
private $notes; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
private $modified; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var int |
44
|
|
|
*/ |
45
|
|
|
private $translated; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var int |
49
|
|
|
*/ |
50
|
|
|
private $untranslated; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var int |
54
|
|
|
*/ |
55
|
|
|
private $incomplate; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var int |
59
|
|
|
*/ |
60
|
|
|
private $plural; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var array |
64
|
|
|
*/ |
65
|
|
|
private $tags = []; |
66
|
|
|
|
67
|
|
|
private function __construct() |
68
|
|
|
{ |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param array $data |
73
|
|
|
* |
74
|
|
|
* @return Asset |
75
|
|
|
*/ |
76
|
|
|
public static function createFromArray(array $data) |
77
|
|
|
{ |
78
|
|
|
$self = new self(); |
79
|
|
|
|
80
|
|
|
if (isset($data['id'])) { |
81
|
|
|
$self->setId($data['id']); |
82
|
|
|
} |
83
|
|
|
if (isset($data['type'])) { |
84
|
|
|
$self->setType($data['type']); |
85
|
|
|
} |
86
|
|
|
if (isset($data['name'])) { |
87
|
|
|
$self->setType($data['type']); |
88
|
|
|
} |
89
|
|
|
if (isset($data['context'])) { |
90
|
|
|
$self->setContext($data['context']); |
91
|
|
|
} |
92
|
|
|
if (isset($data['notes'])) { |
93
|
|
|
$self->setNotes($data['notes']); |
94
|
|
|
} |
95
|
|
|
if (isset($data['modified'])) { |
96
|
|
|
$self->setModified($data['modified']); |
97
|
|
|
} |
98
|
|
|
if (isset($data['translated'])) { |
99
|
|
|
$self->setTranslated($data['translated']); |
100
|
|
|
} |
101
|
|
|
if (isset($data['untranslated'])) { |
102
|
|
|
$self->setUntranslated($data['untranslated']); |
103
|
|
|
} |
104
|
|
|
if (isset($data['incomplete'])) { |
105
|
|
|
$self->setIncomplate($data['incomplete']); |
106
|
|
|
} |
107
|
|
|
if (isset($data['plurals'])) { |
108
|
|
|
$self->setPlurals($data['plurals']); |
109
|
|
|
} |
110
|
|
|
if (isset($data['tags'])) { |
111
|
|
|
$self->setTags($data['tags']); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
return $self; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return string |
119
|
|
|
*/ |
120
|
|
|
public function getId(): string |
121
|
|
|
{ |
122
|
|
|
return $this->id; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param string $id |
127
|
|
|
*/ |
128
|
|
|
private function setId($id) |
129
|
|
|
{ |
130
|
|
|
$this->id = $id; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return string |
135
|
|
|
*/ |
136
|
|
|
public function getType(): string |
137
|
|
|
{ |
138
|
|
|
return $this->type; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param string $type |
143
|
|
|
*/ |
144
|
|
|
private function setType($type) |
145
|
|
|
{ |
146
|
|
|
$this->type = $type; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return string |
151
|
|
|
*/ |
152
|
|
|
public function getName(): string |
153
|
|
|
{ |
154
|
|
|
return $this->name; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param string $name |
159
|
|
|
*/ |
160
|
|
|
private function setName($name) |
|
|
|
|
161
|
|
|
{ |
162
|
|
|
$this->name = $name; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @return string |
167
|
|
|
*/ |
168
|
|
|
public function getContext(): string |
169
|
|
|
{ |
170
|
|
|
return $this->context; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @param string $context |
175
|
|
|
*/ |
176
|
|
|
private function setContext($context) |
177
|
|
|
{ |
178
|
|
|
$this->context = $context; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return string |
183
|
|
|
*/ |
184
|
|
|
public function getNotes(): string |
185
|
|
|
{ |
186
|
|
|
return $this->notes; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param string $notes |
191
|
|
|
*/ |
192
|
|
|
private function setNotes($notes) |
193
|
|
|
{ |
194
|
|
|
$this->notes = $notes; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @return string |
199
|
|
|
*/ |
200
|
|
|
public function getModified(): string |
201
|
|
|
{ |
202
|
|
|
return $this->modified; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* @param string $modified |
207
|
|
|
*/ |
208
|
|
|
private function setModified($modified) |
209
|
|
|
{ |
210
|
|
|
$this->modified = $modified; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @return int |
215
|
|
|
*/ |
216
|
|
|
public function getTranslated(): int |
217
|
|
|
{ |
218
|
|
|
return $this->translated; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @param int $translated |
223
|
|
|
*/ |
224
|
|
|
private function setTranslated($translated) |
225
|
|
|
{ |
226
|
|
|
$this->translated = $translated; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return int |
231
|
|
|
*/ |
232
|
|
|
public function getUntranslated(): int |
233
|
|
|
{ |
234
|
|
|
return $this->untranslated; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @param int $untranslated |
239
|
|
|
*/ |
240
|
|
|
private function setUntranslated($untranslated) |
241
|
|
|
{ |
242
|
|
|
$this->untranslated = $untranslated; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return int |
247
|
|
|
*/ |
248
|
|
|
public function getIncomplate(): int |
249
|
|
|
{ |
250
|
|
|
return $this->incomplate; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @param int $incomplate |
255
|
|
|
*/ |
256
|
|
|
private function setIncomplate($incomplate) |
257
|
|
|
{ |
258
|
|
|
$this->incomplate = $incomplate; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @return int |
263
|
|
|
*/ |
264
|
|
|
public function getPlurals(): int |
265
|
|
|
{ |
266
|
|
|
return $this->plural; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @param int $plural |
271
|
|
|
*/ |
272
|
|
|
private function setPlurals($plural) |
273
|
|
|
{ |
274
|
|
|
$this->plural = $plural; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @return array |
279
|
|
|
*/ |
280
|
|
|
public function getTags(): array |
281
|
|
|
{ |
282
|
|
|
return $this->tags; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* @param array $tags |
287
|
|
|
*/ |
288
|
|
|
private function setTags($tags) |
289
|
|
|
{ |
290
|
|
|
$this->tags = $tags; |
291
|
|
|
} |
292
|
|
|
} |
293
|
|
|
|
This check looks for private methods that have been defined, but are not used inside the class.