1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\Groups; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait; |
6
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TAnonymousFunctionExpressionType; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TApplyExpressionType; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TCollectionExpressionType; |
9
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TEntitySetReferenceExpressionType; |
10
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionReferenceExpressionType; |
11
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TIfExpressionType; |
12
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TParameterReferenceExpressionType; |
13
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyReferenceExpressionType; |
14
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TRecordExpressionType; |
15
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAssertExpressionType; |
16
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeTestExpressionType; |
17
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermReferenceExpressionType; |
18
|
|
|
use AlgoWeb\ODataMetadata\StringTraits\XSDTopLevelTrait; |
19
|
|
|
|
20
|
|
|
trait GExpressionTrait |
21
|
|
|
{ |
22
|
|
|
use XSDTopLevelTrait, IsOKToolboxTrait; |
23
|
|
|
|
24
|
|
|
private $gExpressionMinimum = -1; |
25
|
|
|
private $gExpressionMaximum = -1; |
26
|
|
|
|
27
|
|
|
private $gExpressionSimpleFieldNames = ['string' => 'string', 'binary' => 'hexBinary', 'int' => 'integer', |
28
|
|
|
'float' => 'double', 'guid' => null, 'decimal' => 'decimal', 'bool' => null, 'dateTime' => 'dateTime', |
29
|
|
|
'dateTimeOffset' => 'dateTime', 'enum' => null, 'path' => null]; |
30
|
|
|
private $gExpressionObjectFieldTypes = [ |
31
|
|
|
'if' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TIfExpressionType', |
32
|
|
|
'record' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TRecordExpressionType', |
33
|
|
|
'collection' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TCollectionExpressionType', |
34
|
|
|
'typeAssert' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAssertExpressionType', |
35
|
|
|
'typeTest' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeTestExpressionType', |
36
|
|
|
'functionReference' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionReferenceExpressionType', |
37
|
|
|
'entitySetReference' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TEntitySetReferenceExpressionType', |
38
|
|
|
'anonymousFunction' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TAnonymousFunctionExpressionType', |
39
|
|
|
'parameterReference' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TParameterReferenceExpressionType', |
40
|
|
|
'apply' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TApplyExpressionType', |
41
|
|
|
'propertyReference' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyReferenceExpressionType', |
42
|
|
|
'valueTermReference' => '\AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermReferenceExpressionType' |
43
|
|
|
]; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @property string $string |
47
|
|
|
*/ |
48
|
|
|
private $string = null; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @property mixed $binary |
52
|
|
|
*/ |
53
|
|
|
private $binary = null; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @property integer $int |
57
|
|
|
*/ |
58
|
|
|
private $int = null; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @property float $float |
62
|
|
|
*/ |
63
|
|
|
private $float = null; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @property string $guid |
67
|
|
|
*/ |
68
|
|
|
private $guid = null; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @property float $decimal |
72
|
|
|
*/ |
73
|
|
|
private $decimal = null; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @property boolean $bool |
77
|
|
|
*/ |
78
|
|
|
private $bool = null; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @property \DateTime $dateTime |
82
|
|
|
*/ |
83
|
|
|
private $dateTime = null; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @property \DateTime $dateTimeOffset |
87
|
|
|
*/ |
88
|
|
|
private $dateTimeOffset = null; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @property string $enum |
92
|
|
|
*/ |
93
|
|
|
private $enum = null; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @property string $path |
97
|
|
|
*/ |
98
|
|
|
private $path = null; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TIfExpressionType $if |
102
|
|
|
*/ |
103
|
|
|
private $if = null; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TRecordExpressionType $record |
107
|
|
|
*/ |
108
|
|
|
private $record = null; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TCollectionExpressionType $collection |
112
|
|
|
*/ |
113
|
|
|
private $collection = null; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAssertExpressionType $typeAssert |
117
|
|
|
*/ |
118
|
|
|
private $typeAssert = null; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeTestExpressionType $typeTest |
122
|
|
|
*/ |
123
|
|
|
private $typeTest = null; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionReferenceExpressionType $functionReference |
127
|
|
|
*/ |
128
|
|
|
private $functionReference = null; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntitySetReferenceExpressionType $entitySetReference |
132
|
|
|
*/ |
133
|
|
|
private $entitySetReference = null; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TAnonymousFunctionExpressionType $anonymousFunction |
137
|
|
|
*/ |
138
|
|
|
private $anonymousFunction = null; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TParameterReferenceExpressionType $parameterReference |
142
|
|
|
*/ |
143
|
|
|
private $parameterReference = null; |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TApplyExpressionType $apply |
147
|
|
|
*/ |
148
|
|
|
private $apply = null; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyReferenceExpressionType $propertyReference |
152
|
|
|
*/ |
153
|
|
|
private $propertyReference = null; |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermReferenceExpressionType $valueTermReference |
157
|
|
|
*/ |
158
|
|
|
private $valueTermReference = null; |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Gets as string |
162
|
|
|
* |
163
|
|
|
* @return string |
164
|
|
|
*/ |
165
|
|
|
public function getString() |
166
|
|
|
{ |
167
|
|
|
return $this->string; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Sets a new string |
172
|
|
|
* |
173
|
|
|
* @param string $string |
174
|
|
|
* @return self |
175
|
|
|
*/ |
176
|
|
|
public function setString($string) |
177
|
|
|
{ |
178
|
|
|
$this->string = $string; |
179
|
|
|
return $this; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Gets as binary |
184
|
|
|
* |
185
|
|
|
* @return mixed |
186
|
|
|
*/ |
187
|
|
|
public function getBinary() |
188
|
|
|
{ |
189
|
|
|
return $this->binary; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* Sets a new binary |
194
|
|
|
* |
195
|
|
|
* @param mixed $binary |
196
|
|
|
* @return self |
197
|
|
|
*/ |
198
|
|
|
public function setBinary($binary) |
199
|
|
|
{ |
200
|
|
|
$this->binary = $binary; |
201
|
|
|
return $this; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* Gets as int |
206
|
|
|
* |
207
|
|
|
* @return integer |
208
|
|
|
*/ |
209
|
|
|
public function getInt() |
210
|
|
|
{ |
211
|
|
|
return $this->int; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Sets a new int |
216
|
|
|
* |
217
|
|
|
* @param integer $int |
218
|
|
|
* @return self |
219
|
|
|
*/ |
220
|
|
|
public function setInt($int) |
221
|
|
|
{ |
222
|
|
|
$this->int = $int; |
223
|
|
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Gets as float |
228
|
|
|
* |
229
|
|
|
* @return float |
230
|
|
|
*/ |
231
|
|
|
public function getFloat() |
232
|
|
|
{ |
233
|
|
|
return $this->float; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Sets a new float |
238
|
|
|
* |
239
|
|
|
* @param float $float |
240
|
|
|
* @return self |
241
|
|
|
*/ |
242
|
|
|
public function setFloat($float) |
243
|
|
|
{ |
244
|
|
|
$this->float = $float; |
245
|
|
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* Gets as guid |
250
|
|
|
* |
251
|
|
|
* @return string |
252
|
|
|
*/ |
253
|
|
|
public function getGuid() |
254
|
|
|
{ |
255
|
|
|
return $this->guid; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* Sets a new guid |
260
|
|
|
* |
261
|
|
|
* @param string $guid |
262
|
|
|
* @return self |
263
|
|
|
*/ |
264
|
|
View Code Duplication |
public function setGuid($guid) |
|
|
|
|
265
|
|
|
{ |
266
|
|
|
$msg = null; |
|
|
|
|
267
|
|
|
if (null != $guid && !$this->isTGuidLiteralValid($guid)) { |
|
|
|
|
268
|
|
|
$msg = "Guid must be a valid TGuidLiteral"; |
269
|
|
|
throw new \InvalidArgumentException($msg); |
270
|
|
|
} |
271
|
|
|
$this->guid = $guid; |
272
|
|
|
return $this; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Gets as decimal |
277
|
|
|
* |
278
|
|
|
* @return float |
279
|
|
|
*/ |
280
|
|
|
public function getDecimal() |
281
|
|
|
{ |
282
|
|
|
return $this->decimal; |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* Sets a new decimal |
287
|
|
|
* |
288
|
|
|
* @param float $decimal |
289
|
|
|
* @return self |
290
|
|
|
*/ |
291
|
|
|
public function setDecimal($decimal) |
292
|
|
|
{ |
293
|
|
|
$this->decimal = $decimal; |
294
|
|
|
return $this; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* Gets as bool |
299
|
|
|
* |
300
|
|
|
* @return boolean |
301
|
|
|
*/ |
302
|
|
|
public function getBool() |
303
|
|
|
{ |
304
|
|
|
return $this->bool; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* Sets a new bool |
309
|
|
|
* |
310
|
|
|
* @param boolean $bool |
311
|
|
|
* @return self |
312
|
|
|
*/ |
313
|
|
|
public function setBool($bool) |
314
|
|
|
{ |
315
|
|
|
$this->bool = boolval($bool); |
316
|
|
|
return $this; |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* Gets as dateTime |
321
|
|
|
* |
322
|
|
|
* @return \DateTime |
323
|
|
|
*/ |
324
|
|
|
public function getDateTime() |
325
|
|
|
{ |
326
|
|
|
return $this->dateTime; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* Sets a new dateTime |
331
|
|
|
* |
332
|
|
|
* @param \DateTime $dateTime |
333
|
|
|
* @return self |
334
|
|
|
*/ |
335
|
|
|
public function setDateTime(\DateTime $dateTime) |
336
|
|
|
{ |
337
|
|
|
$this->dateTime = $dateTime; |
338
|
|
|
return $this; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Gets as dateTimeOffset |
343
|
|
|
* |
344
|
|
|
* @return \DateTime |
345
|
|
|
*/ |
346
|
|
|
public function getDateTimeOffset() |
347
|
|
|
{ |
348
|
|
|
return $this->dateTimeOffset; |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* Sets a new dateTimeOffset |
353
|
|
|
* |
354
|
|
|
* @param \DateTime $dateTimeOffset |
355
|
|
|
* @return self |
356
|
|
|
*/ |
357
|
|
|
public function setDateTimeOffset(\DateTime $dateTimeOffset) |
358
|
|
|
{ |
359
|
|
|
$this->dateTimeOffset = $dateTimeOffset; |
360
|
|
|
return $this; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* Gets as enum |
365
|
|
|
* |
366
|
|
|
* @return string |
367
|
|
|
*/ |
368
|
|
|
public function getEnum() |
369
|
|
|
{ |
370
|
|
|
return $this->enum; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
/** |
374
|
|
|
* Sets a new enum |
375
|
|
|
* |
376
|
|
|
* @param string $enum |
377
|
|
|
* @return self |
378
|
|
|
*/ |
379
|
|
View Code Duplication |
public function setEnum($enum) |
|
|
|
|
380
|
|
|
{ |
381
|
|
|
$msg = null; |
|
|
|
|
382
|
|
|
if (null != $enum && !$this->isTQualifiedNameValid($enum)) { |
|
|
|
|
383
|
|
|
$msg = "Enum must be a valid TQualifiedName"; |
384
|
|
|
throw new \InvalidArgumentException($msg); |
385
|
|
|
} |
386
|
|
|
$this->enum = $enum; |
387
|
|
|
return $this; |
388
|
|
|
} |
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* Gets as path |
392
|
|
|
* |
393
|
|
|
* @return string |
394
|
|
|
*/ |
395
|
|
|
public function getPath() |
396
|
|
|
{ |
397
|
|
|
return $this->path; |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
/** |
401
|
|
|
* Sets a new path |
402
|
|
|
* |
403
|
|
|
* @param string $path |
404
|
|
|
* @return self |
405
|
|
|
*/ |
406
|
|
View Code Duplication |
public function setPath($path) |
|
|
|
|
407
|
|
|
{ |
408
|
|
|
$msg = null; |
|
|
|
|
409
|
|
|
if (null != $path && !$this->isTQualifiedNameValid($path)) { |
|
|
|
|
410
|
|
|
$msg = "Path must be a valid TQualifiedName"; |
411
|
|
|
throw new \InvalidArgumentException($msg); |
412
|
|
|
} |
413
|
|
|
$this->path = $path; |
414
|
|
|
return $this; |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* Gets as if |
419
|
|
|
* |
420
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TIfExpressionType |
421
|
|
|
*/ |
422
|
|
|
public function getIf() |
423
|
|
|
{ |
424
|
|
|
return $this->if; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* Sets a new if |
429
|
|
|
* |
430
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TIfExpressionType $if |
431
|
|
|
* @return self |
432
|
|
|
*/ |
433
|
|
|
public function setIf(TIfExpressionType $if) |
434
|
|
|
{ |
435
|
|
|
$msg = null; |
436
|
|
|
if (!$if->isOK($msg)) { |
437
|
|
|
throw new \InvalidArgumentException($msg); |
438
|
|
|
} |
439
|
|
|
$this->if = $if; |
440
|
|
|
return $this; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* Gets as record |
445
|
|
|
* |
446
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TRecordExpressionType |
447
|
|
|
*/ |
448
|
|
|
public function getRecord() |
449
|
|
|
{ |
450
|
|
|
return $this->record; |
451
|
|
|
} |
452
|
|
|
|
453
|
|
|
/** |
454
|
|
|
* Sets a new record |
455
|
|
|
* |
456
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TRecordExpressionType $record |
457
|
|
|
* @return self |
458
|
|
|
*/ |
459
|
|
|
public function setRecord(TRecordExpressionType $record) |
460
|
|
|
{ |
461
|
|
|
$msg = null; |
462
|
|
|
if (!$record->isOK($msg)) { |
463
|
|
|
throw new \InvalidArgumentException($msg); |
464
|
|
|
} |
465
|
|
|
$this->record = $record; |
466
|
|
|
return $this; |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
/** |
470
|
|
|
* Gets as collection |
471
|
|
|
* |
472
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TCollectionExpressionType |
473
|
|
|
*/ |
474
|
|
|
public function getCollection() |
475
|
|
|
{ |
476
|
|
|
return $this->collection; |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* Sets a new collection |
481
|
|
|
* |
482
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TCollectionExpressionType $collection |
483
|
|
|
* @return self |
484
|
|
|
*/ |
485
|
|
|
public function setCollection(TCollectionExpressionType $collection) |
486
|
|
|
{ |
487
|
|
|
$msg = null; |
488
|
|
|
if (!$collection->isOK($msg)) { |
489
|
|
|
throw new \InvalidArgumentException($msg); |
490
|
|
|
} |
491
|
|
|
$this->collection = $collection; |
492
|
|
|
return $this; |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* Gets as typeAssert |
497
|
|
|
* |
498
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAssertExpressionType |
499
|
|
|
*/ |
500
|
|
|
public function getTypeAssert() |
501
|
|
|
{ |
502
|
|
|
return $this->typeAssert; |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
/** |
506
|
|
|
* Sets a new typeAssert |
507
|
|
|
* |
508
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAssertExpressionType $typeAssert |
509
|
|
|
* @return self |
510
|
|
|
*/ |
511
|
|
|
public function setTypeAssert(TTypeAssertExpressionType $typeAssert) |
512
|
|
|
{ |
513
|
|
|
$msg = null; |
514
|
|
|
if (!$typeAssert->isOK($msg)) { |
515
|
|
|
throw new \InvalidArgumentException($msg); |
516
|
|
|
} |
517
|
|
|
$this->typeAssert = $typeAssert; |
518
|
|
|
return $this; |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* Gets as typeTest |
523
|
|
|
* |
524
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeTestExpressionType |
525
|
|
|
*/ |
526
|
|
|
public function getTypeTest() |
527
|
|
|
{ |
528
|
|
|
return $this->typeTest; |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* Sets a new typeTest |
533
|
|
|
* |
534
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeTestExpressionType $typeTest |
535
|
|
|
* @return self |
536
|
|
|
*/ |
537
|
|
|
public function setTypeTest(TTypeTestExpressionType $typeTest) |
538
|
|
|
{ |
539
|
|
|
$msg = null; |
540
|
|
|
if (!$typeTest->isOK($msg)) { |
541
|
|
|
throw new \InvalidArgumentException($msg); |
542
|
|
|
} |
543
|
|
|
$this->typeTest = $typeTest; |
544
|
|
|
return $this; |
545
|
|
|
} |
546
|
|
|
|
547
|
|
|
/** |
548
|
|
|
* Gets as functionReference |
549
|
|
|
* |
550
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionReferenceExpressionType |
551
|
|
|
*/ |
552
|
|
|
public function getFunctionReference() |
553
|
|
|
{ |
554
|
|
|
return $this->functionReference; |
555
|
|
|
} |
556
|
|
|
|
557
|
|
|
/** |
558
|
|
|
* Sets a new functionReference |
559
|
|
|
* |
560
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionReferenceExpressionType $functionReference |
561
|
|
|
* @return self |
562
|
|
|
*/ |
563
|
|
|
public function setFunctionReference(TFunctionReferenceExpressionType $functionReference) |
564
|
|
|
{ |
565
|
|
|
$msg = null; |
566
|
|
|
if (!$functionReference->isOK($msg)) { |
567
|
|
|
throw new \InvalidArgumentException($msg); |
568
|
|
|
} |
569
|
|
|
$this->functionReference = $functionReference; |
570
|
|
|
return $this; |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
/** |
574
|
|
|
* Gets as entitySetReference |
575
|
|
|
* |
576
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntitySetReferenceExpressionType |
577
|
|
|
*/ |
578
|
|
|
public function getEntitySetReference() |
579
|
|
|
{ |
580
|
|
|
return $this->entitySetReference; |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
/** |
584
|
|
|
* Sets a new entitySetReference |
585
|
|
|
* |
586
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TEntitySetReferenceExpressionType $entitySetReference |
587
|
|
|
* @return self |
588
|
|
|
*/ |
589
|
|
|
public function setEntitySetReference(TEntitySetReferenceExpressionType $entitySetReference) |
590
|
|
|
{ |
591
|
|
|
$msg = null; |
592
|
|
|
if (!$entitySetReference->isOK($msg)) { |
593
|
|
|
throw new \InvalidArgumentException($msg); |
594
|
|
|
} |
595
|
|
|
$this->entitySetReference = $entitySetReference; |
596
|
|
|
return $this; |
597
|
|
|
} |
598
|
|
|
|
599
|
|
|
/** |
600
|
|
|
* Gets as anonymousFunction |
601
|
|
|
* |
602
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TAnonymousFunctionExpressionType |
603
|
|
|
*/ |
604
|
|
|
public function getAnonymousFunction() |
605
|
|
|
{ |
606
|
|
|
return $this->anonymousFunction; |
607
|
|
|
} |
608
|
|
|
|
609
|
|
|
/** |
610
|
|
|
* Sets a new anonymousFunction |
611
|
|
|
* |
612
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TAnonymousFunctionExpressionType $anonymousFunction |
613
|
|
|
* @return self |
614
|
|
|
*/ |
615
|
|
|
public function setAnonymousFunction(TAnonymousFunctionExpressionType $anonymousFunction) |
616
|
|
|
{ |
617
|
|
|
$msg = null; |
618
|
|
|
if (!$anonymousFunction->isOK($msg)) { |
619
|
|
|
throw new \InvalidArgumentException($msg); |
620
|
|
|
} |
621
|
|
|
$this->anonymousFunction = $anonymousFunction; |
622
|
|
|
return $this; |
623
|
|
|
} |
624
|
|
|
|
625
|
|
|
/** |
626
|
|
|
* Gets as parameterReference |
627
|
|
|
* |
628
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TParameterReferenceExpressionType |
629
|
|
|
*/ |
630
|
|
|
public function getParameterReference() |
631
|
|
|
{ |
632
|
|
|
return $this->parameterReference; |
633
|
|
|
} |
634
|
|
|
|
635
|
|
|
/** |
636
|
|
|
* Sets a new parameterReference |
637
|
|
|
* |
638
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TParameterReferenceExpressionType $parameterReference |
639
|
|
|
* @return self |
640
|
|
|
*/ |
641
|
|
|
public function setParameterReference(TParameterReferenceExpressionType $parameterReference) |
642
|
|
|
{ |
643
|
|
|
$msg = null; |
644
|
|
|
if (!$parameterReference->isOK($msg)) { |
645
|
|
|
throw new \InvalidArgumentException($msg); |
646
|
|
|
} |
647
|
|
|
$this->parameterReference = $parameterReference; |
648
|
|
|
return $this; |
649
|
|
|
} |
650
|
|
|
|
651
|
|
|
/** |
652
|
|
|
* Gets as apply |
653
|
|
|
* |
654
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TApplyExpressionType |
655
|
|
|
*/ |
656
|
|
|
public function getApply() |
657
|
|
|
{ |
658
|
|
|
return $this->apply; |
659
|
|
|
} |
660
|
|
|
|
661
|
|
|
/** |
662
|
|
|
* Sets a new apply |
663
|
|
|
* |
664
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TApplyExpressionType $apply |
665
|
|
|
* @return self |
666
|
|
|
*/ |
667
|
|
|
public function setApply(TApplyExpressionType $apply) |
668
|
|
|
{ |
669
|
|
|
$msg = null; |
670
|
|
|
if (!$apply->isOK($msg)) { |
671
|
|
|
throw new \InvalidArgumentException($msg); |
672
|
|
|
} |
673
|
|
|
$this->apply = $apply; |
674
|
|
|
return $this; |
675
|
|
|
} |
676
|
|
|
|
677
|
|
|
/** |
678
|
|
|
* Gets as propertyReference |
679
|
|
|
* |
680
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyReferenceExpressionType |
681
|
|
|
*/ |
682
|
|
|
public function getPropertyReference() |
683
|
|
|
{ |
684
|
|
|
return $this->propertyReference; |
685
|
|
|
} |
686
|
|
|
|
687
|
|
|
/** |
688
|
|
|
* Sets a new propertyReference |
689
|
|
|
* |
690
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyReferenceExpressionType $propertyReference |
691
|
|
|
* @return self |
692
|
|
|
*/ |
693
|
|
|
public function setPropertyReference(TPropertyReferenceExpressionType $propertyReference) |
694
|
|
|
{ |
695
|
|
|
$msg = null; |
696
|
|
|
if (!$propertyReference->isOK($msg)) { |
697
|
|
|
throw new \InvalidArgumentException($msg); |
698
|
|
|
} |
699
|
|
|
$this->propertyReference = $propertyReference; |
700
|
|
|
return $this; |
701
|
|
|
} |
702
|
|
|
|
703
|
|
|
/** |
704
|
|
|
* Gets as valueTermReference |
705
|
|
|
* |
706
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermReferenceExpressionType |
707
|
|
|
*/ |
708
|
|
|
public function getValueTermReference() |
709
|
|
|
{ |
710
|
|
|
return $this->valueTermReference; |
711
|
|
|
} |
712
|
|
|
|
713
|
|
|
/** |
714
|
|
|
* Sets a new valueTermReference |
715
|
|
|
* |
716
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueTermReferenceExpressionType $valueTermReference |
717
|
|
|
* @return self |
718
|
|
|
*/ |
719
|
|
|
public function setValueTermReference(TValueTermReferenceExpressionType $valueTermReference) |
720
|
|
|
{ |
721
|
|
|
$msg = null; |
722
|
|
|
if (!$valueTermReference->isOK($msg)) { |
723
|
|
|
throw new \InvalidArgumentException($msg); |
724
|
|
|
} |
725
|
|
|
$this->valueTermReference = $valueTermReference; |
726
|
|
|
return $this; |
727
|
|
|
} |
728
|
|
|
|
729
|
|
|
public function isGExpressionValid(&$msg = null) |
730
|
|
|
{ |
731
|
|
|
if (-1 < $this->gExpressionMinimum || -1 < $this->gExpressionMaximum) { |
732
|
|
|
$counter = 0; |
733
|
|
|
foreach ($this->gExpressionSimpleFieldNames as $name => $type) { |
734
|
|
|
$counter += isset($this->$name) ? 1 : 0; |
735
|
|
|
} |
736
|
|
|
foreach ($this->gExpressionObjectFieldTypes as $name => $type) { |
737
|
|
|
$counter += isset($this->$name) ? 1 : 0; |
738
|
|
|
} |
739
|
|
|
if (-1 < $this->gExpressionMinimum && $counter < $this->gExpressionMinimum) { |
740
|
|
|
$msg = $counter . " fields not null. Need minimum of ".$this->gExpressionMinimum; |
741
|
|
|
return false; |
742
|
|
|
} |
743
|
|
|
if (-1 < $this->gExpressionMaximum && $counter > $this->gExpressionMaximum) { |
744
|
|
|
$msg = $counter . " fields not null. Need maximum of ".$this->gExpressionMaximum; |
745
|
|
|
return false; |
746
|
|
|
} |
747
|
|
|
} |
748
|
|
|
|
749
|
|
View Code Duplication |
if (null != $this->guid && !$this->isTGuidLiteralValid($this->guid)) { |
|
|
|
|
750
|
|
|
$msg = "Guid must be a valid TGuidLiteral"; |
751
|
|
|
return false; |
752
|
|
|
} |
753
|
|
|
|
754
|
|
View Code Duplication |
if (null != $this->enum && !$this->isTQualifiedNameValid($this->enum)) { |
|
|
|
|
755
|
|
|
$msg = "Enum must be a valid TQualifiedName"; |
756
|
|
|
return false; |
757
|
|
|
} |
758
|
|
|
|
759
|
|
View Code Duplication |
if (null != $this->path && !$this->isTQualifiedNameValid($this->path)) { |
|
|
|
|
760
|
|
|
$msg = "Path must be a valid TQualifiedName"; |
761
|
|
|
return false; |
762
|
|
|
} |
763
|
|
|
|
764
|
|
|
foreach ($this->gExpressionSimpleFieldNames as $key => $type) { |
765
|
|
|
if (null != $type) { |
766
|
|
|
// this bit passes if nothing throws an exception |
767
|
|
|
$result = $this->$type($this->$key); |
|
|
|
|
768
|
|
|
} |
769
|
|
|
} |
770
|
|
|
|
771
|
|
|
foreach ($this->gExpressionObjectFieldTypes as $key => $type) { |
772
|
|
|
if (!$this->isObjectNullOrOK($this->$key, $msg)) { |
773
|
|
|
return false; |
774
|
|
|
} |
775
|
|
|
if (!$this->isObjectNullOrType($type, $this->$key)) { |
776
|
|
|
$msg = 'Type mismatch - should be ' .$type. ", is ".get_class($this->$key); |
777
|
|
|
return false; |
778
|
|
|
} |
779
|
|
|
} |
780
|
|
|
|
781
|
|
|
return true; |
782
|
|
|
} |
783
|
|
|
} |
784
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.