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