-
Notifications
You must be signed in to change notification settings - Fork 5
/
ModuleStrictStubs.php
480 lines (394 loc) · 12.8 KB
/
ModuleStrictStubs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
<?php
declare(strict_types=1);
include_once __DIR__ . '/ModuleStubs.php';
class IPSModulePublic extends IPSModule
{
public function __call($name, $arguments)
{
if (!in_array($name, get_class_methods($this))) {
throw "Method $name is not implemented";
}
return $this->{$name}(...$arguments);
}
}
class IPSModuleStrict
{
protected $InstanceID;
private IPSModulePublic $module;
private array $protectedMethods;
public function __construct(int $InstanceID)
{
$this->module = new IPSModulePublic($InstanceID);
$this->InstanceID = $InstanceID;
}
public function Create(): void
{
$this->module->Create();
}
public function Destroy(): void
{
$this->module->Destroy();
}
public function GetProperty(string $Name): mixed
{
return $this->module->GetProperty($Name);
}
public function SetProperty(string $Name, mixed $Value): void
{
$this->module->SetProperty($Name, $Value);
}
public function GetConfiguration(): string
{
return $this->module->GetConfiguration();
}
public function SetConfiguration(string $Configuration): void
{
$this->module->SetConfiguration($Configuration);
}
public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $Data): void
{
$this->module->MessageSink($TimeStamp, $SenderID, $Message, $Data);
}
public function HasChanges(): bool
{
return $this->module->HasChanges();
}
public function ResetChanges(): void
{
$this->module->ResetChanges();
}
public function ApplyChanges(): void
{
$this->module->ApplyChanges();
}
public function GetReceiveDataFilter(): string
{
return $this->module->GetReceiveDataFilter();
}
public function ReceiveData(string $JSONString): string
{
return $this->module->ReceiveData($JSONString);
}
public function ForwardData(string $JSONString): string
{
return $this->module->ForwardData($JSONString);
}
public function GetForwardDataFilter(): string
{
return $this->module->GetForwardDataFilter();
}
public function RequestAction(string $Ident, mixed $Value): void
{
$this->module->RequestAction($Ident, $Value);
}
public function GetConfigurationForm(): string
{
return $this->module->GetConfigurationForm();
}
public function GetConfigurationForParent(): string
{
return $this->module->GetConfigurationForParent();
}
public function Translate(string $Text): string
{
return $this->module->Translate($Text);
}
public function GetReferenceList(): array
{
return $this->module->GetReferenceList();
}
protected function GetIDForIdent(string $Ident): int
{
return $this->module->GetIDForIdent($Ident);
}
protected function RegisterPropertyBoolean(string $Name, bool $DefaultValue): bool
{
$this->module->RegisterPropertyBoolean($Name, $DefaultValue);
return true;
}
protected function RegisterPropertyInteger(string $Name, int $DefaultValue): bool
{
$this->module->RegisterPropertyInteger($Name, $DefaultValue);
return true;
}
protected function RegisterPropertyFloat(string $Name, float $DefaultValue): bool
{
$this->module->RegisterPropertyFloat($Name, $DefaultValue);
return true;
}
protected function RegisterPropertyString(string $Name, string $DefaultValue): bool
{
$this->module->RegisterPropertyString($Name, $DefaultValue);
return true;
}
protected function RegisterAttributeBoolean(string $Name, bool $DefaultValue): bool
{
$this->module->RegisterAttributeBoolean($Name, $DefaultValue);
return true;
}
protected function RegisterAttributeInteger(string $Name, int $DefaultValue): bool
{
$this->module->RegisterAttributeInteger($Name, $DefaultValue);
return true;
}
protected function RegisterAttributeFloat(string $Name, float $DefaultValue): bool
{
$this->module->RegisterAttributeFloat($Name, $DefaultValue);
return true;
}
protected function RegisterAttributeString(string $Name, string $DefaultValue): bool
{
$this->module->RegisterAttributeString($Name, $DefaultValue);
return true;
}
protected function RegisterOnceTimer(string $Ident, string $ScriptText): bool
{
$this->module->RegisterOnceTimer($Ident, $ScriptText);
return true;
}
protected function RegisterTimer(string $Ident, int $Milliseconds, string $ScriptText): bool
{
$this->module->RegisterTimer($Ident, $Milliseconds, $ScriptText);
return true;
}
protected function SetTimerInterval(string $Ident, int $Milliseconds): bool
{
$this->module->SetTimerInterval($Ident, $Milliseconds);
return true;
}
protected function GetTimerInterval(string $Ident): int
{
return $this->module->GetTimerInterval($Ident);
}
protected function RegisterScript(string $Ident, string $Name, string $Content = '', int $Position = 0): int
{
return $this->module->RegisterScript($Ident, $Name, $Content, $Position);
}
protected function RegisterVariableBoolean(string $Ident, string $Name, string $Profile = '', int $Position = 0): bool
{
$variableExists = (@$this->module->GetIDForIdent($Ident) !== false);
$this->module->RegisterVariableBoolean($Ident, $Name, $Profile, $Position);
return !$variableExists;
}
protected function RegisterVariableInteger(string $Ident, string $Name, string $Profile = '', int $Position = 0): bool
{
$variableExists = (@$this->module->GetIDForIdent($Ident) !== null);
$this->module->RegisterVariableInteger($Ident, $Name, $Profile, $Position);
return !$variableExists;
}
protected function RegisterVariableFloat(string $Ident, string $Name, string $Profile = '', int $Position = 0): bool
{
$variableExists = (@$this->module->GetIDForIdent($Ident) !== null);
$this->module->RegisterVariableFloat($Ident, $Name, $Profile, $Position);
return !$variableExists;
}
protected function RegisterVariableString(string $Ident, string $Name, string $Profile = '', int $Position = 0): bool
{
$variableExists = (@$this->module->GetIDForIdent($Ident) !== null);
$this->module->RegisterVariableString($Ident, $Name, $Profile, $Position);
return !$variableExists;
}
protected function UnregisterVariable(string $Ident): bool
{
$this->module->UnregisterMessage($Ident);
return true;
}
protected function MaintainVariable(string $Ident, string $Name, int $Type, string $Profile, int $Position, bool $Keep): bool
{
$this->module->MaintainVariable($Ident, $Name, $Type, $Profile, $Position, $Keep);
return true;
}
protected function EnableAction(string $Ident): bool
{
$this->module->EnableAction($Ident);
return true;
}
protected function DisableAction(string $Ident): bool
{
$this->module->DisableAction($Ident);
return true;
}
protected function MaintainAction(string $Ident, bool $Keep): bool
{
$this->module->MaintainAction($Ident, $Keep);
return true;
}
protected function ReadPropertyBoolean(string $Name): bool
{
return $this->module->ReadPropertyBoolean($Name);
}
protected function ReadPropertyInteger(string $Name): int
{
return $this->module->ReadPropertyInteger($Name);
}
protected function ReadPropertyFloat(string $Name): float
{
return $this->module->ReadPropertyFloat($Name);
}
protected function ReadPropertyString(string $Name): string
{
return $this->module->ReadPropertyString($Name);
}
protected function ReadAttributeBoolean(string $Name): bool
{
return $this->module->ReadAttributeBoolean($Name);
}
protected function ReadAttributeInteger(string $Name): int
{
return $this->module->ReadAttributeInteger($Name);
}
protected function ReadAttributeFloat(string $Name): float
{
return $this->module->ReadAttributeFloat($Name);
}
protected function ReadAttributeString(string $Name): string
{
return $this->module->ReadAttributeString($Name);
}
protected function WriteAttributeBoolean(string $Name, bool $Value): bool
{
$this->module->WriteAttributeBoolean($Name, $Value);
return true;
}
protected function WriteAttributeInteger(string $Name, int $Value): bool
{
$this->module->WriteAttributeInteger($Name, $Value);
return true;
}
protected function WriteAttributeFloat(string $Name, float $Value): bool
{
$this->module->WriteAttributeFloat($Name, $Value);
return true;
}
protected function WriteAttributeString(string $Name, string $Value): bool
{
$this->module->WriteAttributeString($Name, $Value);
return true;
}
protected function SendDataToParent(string $Data): string
{
return $this->module->SendDataToParent($Data) ?? '';
}
protected function SendDataToChildren(string $Data): array
{
return $this->module->SendDataToChildren($Data);
}
protected function ConnectParent(string $ModuleID): bool
{
$this->module->ConnectParent($ModuleID);
return true;
}
protected function RequireParent(string $ModuleID): bool
{
$this->module->RequireParent($ModuleID);
return true;
}
protected function ForceParent(string $ModuleID): bool
{
$this->module->ForceParent($MduleID);
return true;
}
protected function SetStatus(int $Status): bool
{
$this->module->SetStatus($Status);
return true;
}
protected function GetStatus(): int
{
return $this->module->GetStatus();
}
protected function SetSummary(string $Summary): bool
{
$this->module->SetSummary($Summary);
return true;
}
protected function SetBuffer(string $Name, string $Data): bool
{
$this->module->SetBuffer($Name, $Data);
return true;
}
protected function GetBufferList(): array
{
return $this->module->GetBufferList($Name, $Data);
}
protected function GetBuffer(string $Name): string
{
return $this->module->GetBuffer($Name);
}
protected function SendDebug(string $Message, string $Data, int $Format): bool
{
$this->module->SendDebug($Message, $Data, $Format);
return true;
}
protected function GetMessageList(): array
{
return $this->module->GetMessageList();
}
protected function RegisterMessage(int $SenderID, int $Message): bool
{
$this->module->RegisterMessage($SenderID, $Message);
return true;
}
protected function UnregisterMessage(int $SenderID, int $Message): bool
{
$this->module->UnregisterMessage($SenderID, $Message);
return true;
}
protected function SetReceiveDataFilter(string $RequiredRegexMatch): bool
{
$this->module->SetReceiveDataFilter($RequiredRegexMatch);
return true;
}
protected function SetForwardDataFilter(string $RequiredRegexMatch): bool
{
$this->module->SetForwardDataFilter($RequiredRegexMatch);
return true;
}
protected function RegisterReference(int $ID): bool
{
$this->module->RegisterReference($ID);
return true;
}
protected function UnregisterReference(int $ID): bool
{
$this->module->UnregisterReference($ID);
return true;
}
protected function ReloadForm(): bool
{
$this->module->ReloadForm();
return true;
}
protected function UpdateFormField(string $Field, string $Parameter, mixed $Value): bool
{
$this->module->UpdateFormField($Field, $Parameter, $Value);
return true;
}
protected function GetValue(string $Ident): mixed
{
return $this->module->GetValue($Ident);
}
protected function SetValue(string $Ident, mixed $Value): bool
{
return $this->module->SetValue($Ident, $Value);
}
protected function LogMessage(string $Message, int $Type): bool
{
$this->module->LogMessage($Message, $Type);
return true;
}
protected function HasActiveParent(): bool
{
return $this->module->HasActiveParent();
}
protected function RegisterHook(string $HookPath): void
{
}
protected function RegisterOAuth(string $OAuthPath): void
{
}
protected function getTime(): int
{
return $this->module->getTime();
}
}