1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Zemit Framework. |
5
|
|
|
* |
6
|
|
|
* (c) Zemit Team <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE.txt |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Zemit\Support; |
13
|
|
|
|
14
|
|
|
use Zemit\Mvc\Model; |
15
|
|
|
use Zemit\Di\Injectable; |
16
|
|
|
|
17
|
|
|
use Zemit\Models\Backup; |
18
|
|
|
use Zemit\Models\Interfaces\BackupInterface; |
19
|
|
|
|
20
|
|
|
use Zemit\Models\Audit; |
21
|
|
|
use Zemit\Models\Interfaces\AuditInterface; |
22
|
|
|
|
23
|
|
|
use Zemit\Models\AuditDetail; |
24
|
|
|
use Zemit\Models\Interfaces\AuditDetailInterface; |
25
|
|
|
|
26
|
|
|
use Zemit\Models\Feature; |
27
|
|
|
use Zemit\Models\Interfaces\FeatureInterface; |
28
|
|
|
|
29
|
|
|
use Zemit\Models\Log; |
30
|
|
|
use Zemit\Models\Interfaces\LogInterface; |
31
|
|
|
|
32
|
|
|
use Zemit\Models\Email; |
33
|
|
|
use Zemit\Models\Interfaces\EmailInterface; |
34
|
|
|
|
35
|
|
|
use Zemit\Models\Job; |
36
|
|
|
use Zemit\Models\Interfaces\JobInterface; |
37
|
|
|
|
38
|
|
|
use Zemit\Models\File; |
39
|
|
|
use Zemit\Models\Interfaces\FileInterface; |
40
|
|
|
|
41
|
|
|
use Zemit\Models\Session; |
42
|
|
|
use Zemit\Models\Interfaces\SessionInterface; |
43
|
|
|
|
44
|
|
|
use Zemit\Models\Flag; |
45
|
|
|
use Zemit\Models\Interfaces\FlagInterface; |
46
|
|
|
|
47
|
|
|
use Zemit\Models\Setting; |
48
|
|
|
use Zemit\Models\Interfaces\SettingInterface; |
49
|
|
|
|
50
|
|
|
use Zemit\Models\Lang; |
51
|
|
|
use Zemit\Models\Interfaces\LangInterface; |
52
|
|
|
|
53
|
|
|
use Zemit\Models\Translate; |
54
|
|
|
use Zemit\Models\Interfaces\TranslateInterface; |
55
|
|
|
|
56
|
|
|
use Zemit\Models\TranslateField; |
57
|
|
|
use Zemit\Models\Interfaces\TranslateFieldInterface; |
58
|
|
|
|
59
|
|
|
use Zemit\Models\TranslateTable; |
60
|
|
|
use Zemit\Models\Interfaces\TranslateTableInterface; |
61
|
|
|
|
62
|
|
|
use Zemit\Models\Workspace; |
63
|
|
|
use Zemit\Models\Interfaces\WorkspaceInterface; |
64
|
|
|
|
65
|
|
|
use Zemit\Models\WorkspaceLang; |
66
|
|
|
use Zemit\Models\Interfaces\WorkspaceLangInterface; |
67
|
|
|
|
68
|
|
|
use Zemit\Models\Page; |
69
|
|
|
use Zemit\Models\Interfaces\PageInterface; |
70
|
|
|
|
71
|
|
|
use Zemit\Models\Post; |
72
|
|
|
use Zemit\Models\Interfaces\PostInterface; |
73
|
|
|
|
74
|
|
|
use Zemit\Models\Template; |
75
|
|
|
use Zemit\Models\Interfaces\TemplateInterface; |
76
|
|
|
|
77
|
|
|
use Zemit\Models\Table; |
78
|
|
|
use Zemit\Models\Interfaces\TableInterface; |
79
|
|
|
|
80
|
|
|
use Zemit\Models\Field; |
81
|
|
|
use Zemit\Models\Interfaces\FieldInterface; |
82
|
|
|
|
83
|
|
|
use Zemit\Models\Profile; |
84
|
|
|
use Zemit\Models\Interfaces\ProfileInterface; |
85
|
|
|
|
86
|
|
|
use Zemit\Models\User; |
87
|
|
|
use Zemit\Models\Interfaces\UserInterface; |
88
|
|
|
|
89
|
|
|
use Zemit\Models\UserType; |
90
|
|
|
use Zemit\Models\Interfaces\UserTypeInterface; |
91
|
|
|
|
92
|
|
|
use Zemit\Models\UserGroup; |
93
|
|
|
use Zemit\Models\Interfaces\UserGroupInterface; |
94
|
|
|
|
95
|
|
|
use Zemit\Models\UserRole; |
96
|
|
|
use Zemit\Models\Interfaces\UserRoleInterface; |
97
|
|
|
|
98
|
|
|
use Zemit\Models\UserFeature; |
99
|
|
|
use Zemit\Models\Interfaces\UserFeatureInterface; |
100
|
|
|
|
101
|
|
|
use Zemit\Models\Role; |
102
|
|
|
use Zemit\Models\Interfaces\RoleInterface; |
103
|
|
|
|
104
|
|
|
use Zemit\Models\RoleRole; |
105
|
|
|
use Zemit\Models\Interfaces\RoleRoleInterface; |
106
|
|
|
|
107
|
|
|
use Zemit\Models\RoleFeature; |
108
|
|
|
use Zemit\Models\Interfaces\RoleFeatureInterface; |
109
|
|
|
|
110
|
|
|
use Zemit\Models\Group; |
111
|
|
|
use Zemit\Models\Interfaces\GroupInterface; |
112
|
|
|
|
113
|
|
|
use Zemit\Models\GroupRole; |
114
|
|
|
use Zemit\Models\Interfaces\GroupRoleInterface; |
115
|
|
|
|
116
|
|
|
use Zemit\Models\GroupType; |
117
|
|
|
use Zemit\Models\Interfaces\GroupTypeInterface; |
118
|
|
|
|
119
|
|
|
use Zemit\Models\GroupFeature; |
120
|
|
|
use Zemit\Models\Interfaces\GroupFeatureInterface; |
121
|
|
|
|
122
|
|
|
use Zemit\Models\Type; |
123
|
|
|
use Zemit\Models\Interfaces\TypeInterface; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Allow to get mapped classes without using magic methods |
127
|
|
|
*/ |
128
|
|
|
class Models extends Injectable |
129
|
|
|
{ |
130
|
|
|
use ModelsMap; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Store an array of instances |
134
|
|
|
*/ |
135
|
|
|
public ?array $instances = null; |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* |
139
|
|
|
*/ |
140
|
|
|
public function __construct(?array $mapping = null) |
141
|
|
|
{ |
142
|
|
|
$this->setModelsMap($mapping); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Get an array of mapped models |
147
|
|
|
*/ |
148
|
|
|
public function getInstances(): array |
149
|
|
|
{ |
150
|
|
|
return $this->instances; |
|
|
|
|
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Set the instance for a class |
155
|
|
|
*/ |
156
|
|
|
public function setInstance(string $class, Model $instance): void |
157
|
|
|
{ |
158
|
|
|
$this->instances[$class] = $instance; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Remove an existing class |
163
|
|
|
*/ |
164
|
|
|
public function unsetInstance(string $map): void |
165
|
|
|
{ |
166
|
|
|
unset($this->instances[$map]); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* Return an instance of a specified class implementing Model interface |
171
|
|
|
* |
172
|
|
|
* @param string $class The fully qualified class name |
173
|
|
|
* @return Model An instance of the specified class |
174
|
|
|
*/ |
175
|
|
|
public function getInstance(string $class): Model |
176
|
|
|
{ |
177
|
|
|
if (!isset($this->instances[$class])) { |
178
|
|
|
$map = $this->getClassMap($class); |
179
|
|
|
$instance = new $map(); |
180
|
|
|
assert($instance instanceof Model); |
181
|
|
|
$this->setInstance($class, $instance); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
return $this->instances[$class]; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Return an instance of \Zemit\Models\Interfaces\BackupInterface |
189
|
|
|
*/ |
190
|
|
|
public function getBackup(): BackupInterface |
191
|
|
|
{ |
192
|
|
|
$instance = $this->getInstance(Backup::class); |
193
|
|
|
assert($instance instanceof BackupInterface); |
194
|
|
|
return $instance; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Return an instance of \Zemit\Models\Interfaces\AuditInterface |
199
|
|
|
*/ |
200
|
|
|
public function getAudit(): AuditInterface |
201
|
|
|
{ |
202
|
|
|
$instance = $this->getInstance(Audit::class); |
203
|
|
|
assert($instance instanceof AuditInterface); |
204
|
|
|
return $instance; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* Return an instance of \Zemit\Models\Interfaces\AuditDetailInterface |
209
|
|
|
*/ |
210
|
|
|
public function getAuditDetail(): AuditDetailInterface |
211
|
|
|
{ |
212
|
|
|
$instance = $this->getInstance(AuditDetail::class); |
213
|
|
|
assert($instance instanceof AuditDetailInterface); |
214
|
|
|
return $instance; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* Return an instance of \Zemit\Models\Interfaces\LogInterface |
219
|
|
|
*/ |
220
|
|
|
public function getLog(): LogInterface |
221
|
|
|
{ |
222
|
|
|
$instance = $this->getInstance(Log::class); |
223
|
|
|
assert($instance instanceof LogInterface); |
224
|
|
|
return $instance; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* Return an instance of \Zemit\Models\Interfaces\EmailInterface |
229
|
|
|
*/ |
230
|
|
|
public function getEmail(): EmailInterface |
231
|
|
|
{ |
232
|
|
|
$instance = $this->getInstance(Email::class); |
233
|
|
|
assert($instance instanceof EmailInterface); |
234
|
|
|
return $instance; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* Return an instance of \Zemit\Models\Interfaces\JobInterface |
239
|
|
|
*/ |
240
|
|
|
public function getJob(): JobInterface |
241
|
|
|
{ |
242
|
|
|
$instance = $this->getInstance(Job::class); |
243
|
|
|
assert($instance instanceof JobInterface); |
244
|
|
|
return $instance; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* Return an instance of \Zemit\Models\Interfaces\FileInterface |
249
|
|
|
*/ |
250
|
|
|
public function getFile(): FileInterface |
251
|
|
|
{ |
252
|
|
|
$instance = $this->getInstance(File::class); |
253
|
|
|
assert($instance instanceof FileInterface); |
254
|
|
|
return $instance; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Return an instance of \Zemit\Models\Interfaces\SessionInterface |
259
|
|
|
*/ |
260
|
|
|
public function getSession(): SessionInterface |
261
|
|
|
{ |
262
|
|
|
$instance = $this->getInstance(Session::class); |
263
|
|
|
assert($instance instanceof SessionInterface); |
264
|
|
|
return $instance; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* Return an instance of \Zemit\Models\Interfaces\FlagInterface |
269
|
|
|
*/ |
270
|
|
|
public function getFlag(): FlagInterface |
271
|
|
|
{ |
272
|
|
|
$instance = $this->getInstance(Flag::class); |
273
|
|
|
assert($instance instanceof FlagInterface); |
274
|
|
|
return $instance; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* Return an instance of \Zemit\Models\Interfaces\SettingInterface |
279
|
|
|
*/ |
280
|
|
|
public function getSetting(): SettingInterface |
281
|
|
|
{ |
282
|
|
|
$instance = $this->getInstance(Setting::class); |
283
|
|
|
assert($instance instanceof SettingInterface); |
284
|
|
|
return $instance; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Return an instance of \Zemit\Models\Interfaces\LangInterface |
289
|
|
|
*/ |
290
|
|
|
public function getLang(): LangInterface |
291
|
|
|
{ |
292
|
|
|
$instance = $this->getInstance(Lang::class); |
293
|
|
|
assert($instance instanceof LangInterface); |
294
|
|
|
return $instance; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* Return an instance of \Zemit\Models\Interfaces\TranslateInterface |
299
|
|
|
*/ |
300
|
|
|
public function getTranslate(): TranslateInterface |
301
|
|
|
{ |
302
|
|
|
$instance = $this->getInstance(Translate::class); |
303
|
|
|
assert($instance instanceof TranslateInterface); |
304
|
|
|
return $instance; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* Return an instance of \Zemit\Models\Interfaces\TranslateFieldInterface |
309
|
|
|
*/ |
310
|
|
|
public function getTranslateField(): TranslateFieldInterface |
311
|
|
|
{ |
312
|
|
|
$instance = $this->getInstance(TranslateField::class); |
313
|
|
|
assert($instance instanceof TranslateFieldInterface); |
314
|
|
|
return $instance; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* Return an instance of \Zemit\Models\Interfaces\TranslateTableInterface |
319
|
|
|
*/ |
320
|
|
|
public function getTranslateTable(): TranslateTableInterface |
321
|
|
|
{ |
322
|
|
|
$instance = $this->getInstance(TranslateTable::class); |
323
|
|
|
assert($instance instanceof TranslateTableInterface); |
324
|
|
|
return $instance; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* Return an instance of \Zemit\Models\Interfaces\WorkspaceInterface |
329
|
|
|
*/ |
330
|
|
|
public function getWorkspace(): WorkspaceInterface |
331
|
|
|
{ |
332
|
|
|
$instance = $this->getInstance(Workspace::class); |
333
|
|
|
assert($instance instanceof WorkspaceInterface); |
334
|
|
|
return $instance; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* Return an instance of \Zemit\Models\Interfaces\WorkspaceInterface |
339
|
|
|
*/ |
340
|
|
|
public function getWorkspaceLang(): WorkspaceLangInterface |
341
|
|
|
{ |
342
|
|
|
$instance = $this->getInstance(WorkspaceLang::class); |
343
|
|
|
assert($instance instanceof WorkspaceLangInterface); |
344
|
|
|
return $instance; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Return an instance of \Zemit\Models\Interfaces\PageInterface |
349
|
|
|
*/ |
350
|
|
|
public function getPage(): PageInterface |
351
|
|
|
{ |
352
|
|
|
$instance = $this->getInstance(Page::class); |
353
|
|
|
assert($instance instanceof PageInterface); |
354
|
|
|
return $instance; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Return an instance of \Zemit\Models\Interfaces\PostInterface |
359
|
|
|
*/ |
360
|
|
|
public function getPost(): PostInterface |
361
|
|
|
{ |
362
|
|
|
$instance = $this->getInstance(Post::class); |
363
|
|
|
assert($instance instanceof PostInterface); |
364
|
|
|
return $instance; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Return an instance of \Zemit\Models\Interfaces\TemplateInterface |
369
|
|
|
*/ |
370
|
|
|
public function getTemplate(): TemplateInterface |
371
|
|
|
{ |
372
|
|
|
$instance = $this->getInstance(Template::class); |
373
|
|
|
assert($instance instanceof TemplateInterface); |
374
|
|
|
return $instance; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* Return an instance of \Zemit\Models\Interfaces\TableInterface |
379
|
|
|
*/ |
380
|
|
|
public function getTable(): TableInterface |
381
|
|
|
{ |
382
|
|
|
$instance = $this->getInstance(Table::class); |
383
|
|
|
assert($instance instanceof TableInterface); |
384
|
|
|
return $instance; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* Return an instance of \Zemit\Models\Interfaces\FieldInterface |
389
|
|
|
*/ |
390
|
|
|
public function getField(): FieldInterface |
391
|
|
|
{ |
392
|
|
|
$instance = $this->getInstance(Field::class); |
393
|
|
|
assert($instance instanceof FieldInterface); |
394
|
|
|
return $instance; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* Return an instance of \Zemit\Models\Interfaces\ProfileInterface |
399
|
|
|
*/ |
400
|
|
|
public function getProfile(): ProfileInterface |
401
|
|
|
{ |
402
|
|
|
$instance = $this->getInstance(Profile::class); |
403
|
|
|
assert($instance instanceof ProfileInterface); |
404
|
|
|
return $instance; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* Return an instance of \Zemit\Models\Interfaces\UserInterface |
409
|
|
|
*/ |
410
|
|
|
public function getUser(): UserInterface |
411
|
|
|
{ |
412
|
|
|
$instance = $this->getInstance(User::class); |
413
|
|
|
assert($instance instanceof UserInterface); |
414
|
|
|
return $instance; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* Return an instance of \Zemit\Models\Interfaces\UserTypeInterface |
419
|
|
|
*/ |
420
|
|
|
public function getUserType(): UserTypeInterface |
421
|
|
|
{ |
422
|
|
|
$instance = $this->getInstance(UserType::class); |
423
|
|
|
assert($instance instanceof UserTypeInterface); |
424
|
|
|
return $instance; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* Return an instance of \Zemit\Models\Interfaces\UserGroupInterface |
429
|
|
|
*/ |
430
|
|
|
public function getUserGroup(): UserGroupInterface |
431
|
|
|
{ |
432
|
|
|
$instance = $this->getInstance(UserGroup::class); |
433
|
|
|
assert($instance instanceof UserGroupInterface); |
434
|
|
|
return $instance; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Return an instance of \Zemit\Models\Interfaces\UserRoleInterface |
439
|
|
|
*/ |
440
|
|
|
public function getUserRole(): UserRoleInterface |
441
|
|
|
{ |
442
|
|
|
$instance = $this->getInstance(UserRole::class); |
443
|
|
|
assert($instance instanceof UserRoleInterface); |
444
|
|
|
return $instance; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* Return an instance of \Zemit\Models\Interfaces\UserFeatureInterface |
449
|
|
|
*/ |
450
|
|
|
public function getUserFeature(): UserFeatureInterface |
451
|
|
|
{ |
452
|
|
|
$instance = $this->getInstance(UserFeature::class); |
453
|
|
|
assert($instance instanceof UserFeatureInterface); |
454
|
|
|
return $instance; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* Return an instance of \Zemit\Models\Interfaces\RoleInterface |
459
|
|
|
*/ |
460
|
|
|
public function getRole(): RoleInterface |
461
|
|
|
{ |
462
|
|
|
$instance = $this->getInstance(Role::class); |
463
|
|
|
assert($instance instanceof RoleInterface); |
464
|
|
|
return $instance; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* Return an instance of \Zemit\Models\Interfaces\RoleRoleInterface |
469
|
|
|
*/ |
470
|
|
|
public function getRoleRole(): RoleRoleInterface |
471
|
|
|
{ |
472
|
|
|
$instance = $this->getInstance(RoleRole::class); |
473
|
|
|
assert($instance instanceof RoleRoleInterface); |
474
|
|
|
return $instance; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
/** |
478
|
|
|
* Return an instance of \Zemit\Models\Interfaces\RoleFeatureInterface |
479
|
|
|
*/ |
480
|
|
|
public function getRoleFeature(): RoleFeatureInterface |
481
|
|
|
{ |
482
|
|
|
$instance = $this->getInstance(RoleFeature::class); |
483
|
|
|
assert($instance instanceof RoleFeatureInterface); |
484
|
|
|
return $instance; |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
/** |
488
|
|
|
* Return an instance of \Zemit\Models\Interfaces\GroupInterface |
489
|
|
|
*/ |
490
|
|
|
public function getGroup(): GroupInterface |
491
|
|
|
{ |
492
|
|
|
$instance = $this->getInstance(Group::class); |
493
|
|
|
assert($instance instanceof GroupInterface); |
494
|
|
|
return $instance; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
/** |
498
|
|
|
* Return an instance of \Zemit\Models\Interfaces\GroupRoleInterface |
499
|
|
|
*/ |
500
|
|
|
public function getGroupRole(): GroupRoleInterface |
501
|
|
|
{ |
502
|
|
|
$instance = $this->getInstance(GroupRole::class); |
503
|
|
|
assert($instance instanceof GroupRoleInterface); |
504
|
|
|
return $instance; |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* Return an instance of \Zemit\Models\Interfaces\GroupTypeInterface |
509
|
|
|
*/ |
510
|
|
|
public function getGroupType(): GroupTypeInterface |
511
|
|
|
{ |
512
|
|
|
$instance = $this->getInstance(GroupType::class); |
513
|
|
|
assert($instance instanceof GroupTypeInterface); |
514
|
|
|
return $instance; |
515
|
|
|
} |
516
|
|
|
|
517
|
|
|
/** |
518
|
|
|
* Return an instance of \Zemit\Models\Interfaces\GroupFeatureInterface |
519
|
|
|
*/ |
520
|
|
|
public function getGroupFeature(): GroupFeatureInterface |
521
|
|
|
{ |
522
|
|
|
$instance = $this->getInstance(GroupFeature::class); |
523
|
|
|
assert($instance instanceof GroupFeatureInterface); |
524
|
|
|
return $instance; |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
/** |
528
|
|
|
* Return an instance of \Zemit\Models\Interfaces\TypeInterface |
529
|
|
|
*/ |
530
|
|
|
public function getType(): TypeInterface |
531
|
|
|
{ |
532
|
|
|
$instance = $this->getInstance(Type::class); |
533
|
|
|
assert($instance instanceof TypeInterface); |
534
|
|
|
return $instance; |
535
|
|
|
} |
536
|
|
|
|
537
|
|
|
/** |
538
|
|
|
* Return an instance of \Zemit\Models\Interfaces\FeatureInterface |
539
|
|
|
*/ |
540
|
|
|
public function getFeature(): FeatureInterface |
541
|
|
|
{ |
542
|
|
|
$instance = $this->getInstance(Feature::class); |
543
|
|
|
assert($instance instanceof FeatureInterface); |
544
|
|
|
return $instance; |
545
|
|
|
} |
546
|
|
|
} |
547
|
|
|
|