1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WebHemi. |
4
|
|
|
* |
5
|
|
|
* PHP version 7.1 |
6
|
|
|
* |
7
|
|
|
* @copyright 2012 - 2018 Gixx-web (http://www.gixx-web.com) |
8
|
|
|
* @license https://opensource.org/licenses/MIT The MIT License (MIT) |
9
|
|
|
* |
10
|
|
|
* @link http://www.gixx-web.com |
11
|
|
|
*/ |
12
|
|
|
declare(strict_types = 1); |
13
|
|
|
|
14
|
|
|
namespace WebHemi\Data\Entity; |
15
|
|
|
|
16
|
|
|
use DateTimeZone; |
17
|
|
|
use WebHemi\DateTime; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class AbstractEntity |
21
|
|
|
*/ |
22
|
|
|
class ApplicationEntity extends AbstractEntity |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var array |
26
|
|
|
*/ |
27
|
|
|
protected $container = [ |
28
|
|
|
'id_application' => null, |
29
|
|
|
'name' => null, |
30
|
|
|
'title' => null, |
31
|
|
|
'introduction' => null, |
32
|
|
|
'subject' => null, |
33
|
|
|
'description' => null, |
34
|
|
|
'keywords' => null, |
35
|
|
|
'copyright' => null, |
36
|
|
|
'path' => null, |
37
|
|
|
'theme' => null, |
38
|
|
|
'type' => null, |
39
|
|
|
'locale' => null, |
40
|
|
|
'timezone' => null, |
41
|
|
|
'is_read_only' => null, |
42
|
|
|
'is_enabled' => null, |
43
|
|
|
'date_created' => null, |
44
|
|
|
'date_modified' => null, |
45
|
|
|
]; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param int $identifier |
49
|
|
|
* @return ApplicationEntity |
50
|
|
|
*/ |
51
|
2 |
|
public function setApplicationId(int $identifier) : ApplicationEntity |
52
|
|
|
{ |
53
|
2 |
|
$this->container['id_application'] = $identifier; |
54
|
|
|
|
55
|
2 |
|
return $this; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return int|null |
60
|
|
|
*/ |
61
|
2 |
|
public function getApplicationId() : ? int |
62
|
|
|
{ |
63
|
2 |
|
return !is_null($this->container['id_application']) |
64
|
2 |
|
? (int) $this->container['id_application'] |
65
|
2 |
|
: null; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param string $name |
70
|
|
|
* @return ApplicationEntity |
71
|
|
|
*/ |
72
|
1 |
|
public function setName(string $name) : ApplicationEntity |
73
|
|
|
{ |
74
|
1 |
|
$this->container['name'] = $name; |
75
|
|
|
|
76
|
1 |
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return null|string |
81
|
|
|
*/ |
82
|
|
|
public function getName() : ? string |
83
|
|
|
{ |
84
|
|
|
return $this->container['name']; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param string $title |
89
|
|
|
* @return ApplicationEntity |
90
|
|
|
*/ |
91
|
|
|
public function setTitle(string $title) : ApplicationEntity |
92
|
|
|
{ |
93
|
|
|
$this->container['title'] = $title; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return null|string |
100
|
|
|
*/ |
101
|
|
|
public function getTitle() : ? string |
102
|
|
|
{ |
103
|
|
|
return $this->container['title']; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param string $introduction |
108
|
|
|
* @return ApplicationEntity |
109
|
|
|
*/ |
110
|
|
|
public function setIntroduction(string $introduction) : ApplicationEntity |
111
|
|
|
{ |
112
|
|
|
$this->container['introduction'] = $introduction; |
113
|
|
|
|
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return null|string |
119
|
|
|
*/ |
120
|
|
|
public function getIntroduction() : ? string |
121
|
|
|
{ |
122
|
|
|
return $this->container['introduction']; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param string $subject |
127
|
|
|
* @return ApplicationEntity |
128
|
|
|
*/ |
129
|
|
|
public function setSubject(string $subject) : ApplicationEntity |
130
|
|
|
{ |
131
|
|
|
$this->container['subject'] = $subject; |
132
|
|
|
|
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return null|string |
138
|
|
|
*/ |
139
|
|
|
public function getSubject() : ? string |
140
|
|
|
{ |
141
|
|
|
return $this->container['subject']; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param string $description |
146
|
|
|
* @return ApplicationEntity |
147
|
|
|
*/ |
148
|
|
|
public function setDescription(string $description) : ApplicationEntity |
149
|
|
|
{ |
150
|
|
|
$this->container['description'] = $description; |
151
|
|
|
|
152
|
|
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return null|string |
157
|
|
|
*/ |
158
|
|
|
public function getDescription() : ? string |
159
|
|
|
{ |
160
|
|
|
return $this->container['description']; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param string $keywords |
165
|
|
|
* @return ApplicationEntity |
166
|
|
|
*/ |
167
|
|
|
public function setKeywords(string $keywords) : ApplicationEntity |
168
|
|
|
{ |
169
|
|
|
$this->container['keywords'] = $keywords; |
170
|
|
|
|
171
|
|
|
return $this; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @return null|string |
176
|
|
|
*/ |
177
|
|
|
public function getKeywords() : ? string |
178
|
|
|
{ |
179
|
|
|
return $this->container['keywords']; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @param string $copyright |
184
|
|
|
* @return ApplicationEntity |
185
|
|
|
*/ |
186
|
|
|
public function setCopyright(string $copyright) : ApplicationEntity |
187
|
|
|
{ |
188
|
|
|
$this->container['copyright'] = $copyright; |
189
|
|
|
|
190
|
|
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return null|string |
195
|
|
|
*/ |
196
|
|
|
public function getCopyright() : ? string |
197
|
|
|
{ |
198
|
|
|
return $this->container['copyright']; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @param string $path |
203
|
|
|
* @return ApplicationEntity |
204
|
|
|
*/ |
205
|
|
|
public function setPath(string $path) : ApplicationEntity |
206
|
|
|
{ |
207
|
|
|
$this->container['path'] = $path; |
208
|
|
|
|
209
|
|
|
return $this; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @return null|string |
214
|
|
|
*/ |
215
|
|
|
public function getPath() : ? string |
216
|
|
|
{ |
217
|
|
|
return $this->container['path']; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @param string $theme |
222
|
|
|
* @return ApplicationEntity |
223
|
|
|
*/ |
224
|
|
|
public function setTheme(string $theme) : ApplicationEntity |
225
|
|
|
{ |
226
|
|
|
$this->container['theme'] = $theme; |
227
|
|
|
|
228
|
|
|
return $this; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* @return null|string |
233
|
|
|
*/ |
234
|
|
|
public function getTheme() : ? string |
235
|
|
|
{ |
236
|
|
|
return $this->container['theme']; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @param string $type |
241
|
|
|
* @return ApplicationEntity |
242
|
|
|
*/ |
243
|
|
|
public function setType(string $type) : ApplicationEntity |
244
|
|
|
{ |
245
|
|
|
$this->container['type'] = $type; |
246
|
|
|
|
247
|
|
|
return $this; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @return null|string |
252
|
|
|
*/ |
253
|
|
|
public function getType() : ? string |
254
|
|
|
{ |
255
|
|
|
return $this->container['type']; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* @param string $locale |
260
|
|
|
* @return ApplicationEntity |
261
|
|
|
*/ |
262
|
|
|
public function setLocale(string $locale) : ApplicationEntity |
263
|
|
|
{ |
264
|
|
|
$this->container['locale'] = $locale; |
265
|
|
|
|
266
|
|
|
return $this; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @return null|string |
271
|
|
|
*/ |
272
|
|
|
public function getLocale() : ? string |
273
|
|
|
{ |
274
|
|
|
return $this->container['locale']; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @param DateTimeZone $timeZone |
279
|
|
|
* @return ApplicationEntity |
280
|
|
|
*/ |
281
|
|
|
public function setTimeZone(DateTimeZone $timeZone) : ApplicationEntity |
282
|
|
|
{ |
283
|
|
|
$this->container['timezone'] = $timeZone->getName(); |
284
|
|
|
|
285
|
|
|
return $this; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* @return DateTimeZone|null |
290
|
|
|
*/ |
291
|
|
|
public function getTimeZone() : ? DateTimeZone |
292
|
|
|
{ |
293
|
|
|
return !empty($this->container['timezone']) |
294
|
|
|
? new DateTimeZone($this->container['timezone']) |
295
|
|
|
: null; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @param bool $isReadonly |
300
|
|
|
* @return ApplicationEntity |
301
|
|
|
*/ |
302
|
|
|
public function setIsReadOnly(bool $isReadonly) : ApplicationEntity |
303
|
|
|
{ |
304
|
|
|
$this->container['is_read_only'] = $isReadonly ? 1 : 0; |
305
|
|
|
|
306
|
|
|
return $this; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @return bool |
311
|
|
|
*/ |
312
|
|
|
public function getIsReadOnly() : bool |
313
|
|
|
{ |
314
|
|
|
return !empty($this->container['is_read_only']); |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @param bool $isEnabled |
319
|
|
|
* @return ApplicationEntity |
320
|
|
|
*/ |
321
|
|
|
public function setIsEnabled(bool $isEnabled) : ApplicationEntity |
322
|
|
|
{ |
323
|
|
|
$this->container['is_enabled'] = $isEnabled ? 1 : 0; |
324
|
|
|
|
325
|
|
|
return $this; |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* @return bool |
330
|
|
|
*/ |
331
|
|
|
public function getIsEnabled() : bool |
332
|
|
|
{ |
333
|
|
|
return !empty($this->container['is_enabled']); |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* @param DateTime $dateTime |
338
|
|
|
* @return ApplicationEntity |
339
|
|
|
*/ |
340
|
|
|
public function setDateCreated(DateTime $dateTime) : ApplicationEntity |
341
|
|
|
{ |
342
|
|
|
$this->container['date_created'] = $dateTime->format('Y-m-d H:i:s'); |
343
|
|
|
|
344
|
|
|
return $this; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* @return null|DateTime |
349
|
|
|
*/ |
350
|
|
|
public function getDateCreated() : ? DateTime |
351
|
|
|
{ |
352
|
|
|
return !empty($this->container['date_created']) |
353
|
|
|
? new DateTime($this->container['date_created']) |
354
|
|
|
: null; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* @param DateTime $dateTime |
359
|
|
|
* @return ApplicationEntity |
360
|
|
|
*/ |
361
|
|
|
public function setDateModified(DateTime $dateTime) : ApplicationEntity |
362
|
|
|
{ |
363
|
|
|
$this->container['date_modified'] = $dateTime->format('Y-m-d H:i:s'); |
364
|
|
|
|
365
|
|
|
return $this; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* @return null|DateTime |
370
|
|
|
*/ |
371
|
|
|
public function getDateModified() : ? DateTime |
372
|
|
|
{ |
373
|
|
|
return !empty($this->container['date_modified']) |
374
|
|
|
? new DateTime($this->container['date_modified']) |
375
|
|
|
: null; |
376
|
|
|
} |
377
|
|
|
} |
378
|
|
|
|