1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\IsOKTraits\IsOKToolboxTrait; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\Groups\TEntitySetAttributesTrait; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType; |
9
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType; |
10
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class representing EntitySetAnonymousType |
14
|
|
|
*/ |
15
|
|
|
class EntitySetAnonymousType extends IsOK |
16
|
|
|
{ |
17
|
|
|
use IsOKToolboxTrait, TEntitySetAttributesTrait; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] $documentation |
21
|
|
|
*/ |
22
|
|
|
private $documentation = []; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
26
|
|
|
*/ |
27
|
|
|
private $valueAnnotation = []; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
31
|
|
|
*/ |
32
|
|
|
private $typeAnnotation = []; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Adds as documentation |
36
|
|
|
* |
37
|
|
|
* @return self |
38
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType $documentation |
39
|
|
|
*/ |
40
|
|
|
public function addToDocumentation(TDocumentationType $documentation) |
41
|
|
|
{ |
42
|
|
|
$this->documentation[] = $documentation; |
43
|
|
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* isset documentation |
48
|
|
|
* |
49
|
|
|
* @param scalar $index |
50
|
|
|
* @return boolean |
51
|
|
|
*/ |
52
|
|
|
public function issetDocumentation($index) |
53
|
|
|
{ |
54
|
|
|
return isset($this->documentation[$index]); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* unset documentation |
59
|
|
|
* |
60
|
|
|
* @param scalar $index |
61
|
|
|
* @return void |
62
|
|
|
*/ |
63
|
|
|
public function unsetDocumentation($index) |
64
|
|
|
{ |
65
|
|
|
unset($this->documentation[$index]); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Gets as documentation |
70
|
|
|
* |
71
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] |
72
|
|
|
*/ |
73
|
|
|
public function getDocumentation() |
74
|
|
|
{ |
75
|
|
|
return $this->documentation; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Sets a new documentation |
80
|
|
|
* |
81
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType[] $documentation |
82
|
|
|
* @return self |
83
|
|
|
*/ |
84
|
|
|
public function setDocumentation(array $documentation) |
85
|
|
|
{ |
86
|
|
|
$this->documentation = $documentation; |
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Adds as valueAnnotation |
92
|
|
|
* |
93
|
|
|
* @return self |
94
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType $valueAnnotation |
95
|
|
|
*/ |
96
|
|
|
public function addToValueAnnotation(TValueAnnotationType $valueAnnotation) |
97
|
|
|
{ |
98
|
|
|
$this->valueAnnotation[] = $valueAnnotation; |
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* isset valueAnnotation |
104
|
|
|
* |
105
|
|
|
* @param scalar $index |
106
|
|
|
* @return boolean |
107
|
|
|
*/ |
108
|
|
|
public function issetValueAnnotation($index) |
109
|
|
|
{ |
110
|
|
|
return isset($this->valueAnnotation[$index]); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* unset valueAnnotation |
115
|
|
|
* |
116
|
|
|
* @param scalar $index |
117
|
|
|
* @return void |
118
|
|
|
*/ |
119
|
|
|
public function unsetValueAnnotation($index) |
120
|
|
|
{ |
121
|
|
|
unset($this->valueAnnotation[$index]); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Gets as valueAnnotation |
126
|
|
|
* |
127
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] |
128
|
|
|
*/ |
129
|
|
|
public function getValueAnnotation() |
130
|
|
|
{ |
131
|
|
|
return $this->valueAnnotation; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Sets a new valueAnnotation |
136
|
|
|
* |
137
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType[] $valueAnnotation |
138
|
|
|
* @return self |
139
|
|
|
*/ |
140
|
|
|
public function setValueAnnotation(array $valueAnnotation) |
141
|
|
|
{ |
142
|
|
|
$this->valueAnnotation = $valueAnnotation; |
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Adds as typeAnnotation |
148
|
|
|
* |
149
|
|
|
* @return self |
150
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType $typeAnnotation |
151
|
|
|
*/ |
152
|
|
|
public function addToTypeAnnotation(TTypeAnnotationType $typeAnnotation) |
153
|
|
|
{ |
154
|
|
|
$this->typeAnnotation[] = $typeAnnotation; |
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* isset typeAnnotation |
160
|
|
|
* |
161
|
|
|
* @param scalar $index |
162
|
|
|
* @return boolean |
163
|
|
|
*/ |
164
|
|
|
public function issetTypeAnnotation($index) |
165
|
|
|
{ |
166
|
|
|
return isset($this->typeAnnotation[$index]); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* unset typeAnnotation |
171
|
|
|
* |
172
|
|
|
* @param scalar $index |
173
|
|
|
* @return void |
174
|
|
|
*/ |
175
|
|
|
public function unsetTypeAnnotation($index) |
176
|
|
|
{ |
177
|
|
|
unset($this->typeAnnotation[$index]); |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Gets as typeAnnotation |
182
|
|
|
* |
183
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] |
184
|
|
|
*/ |
185
|
|
|
public function getTypeAnnotation() |
186
|
|
|
{ |
187
|
|
|
return $this->typeAnnotation; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Sets a new typeAnnotation |
192
|
|
|
* |
193
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType[] $typeAnnotation |
194
|
|
|
* @return self |
195
|
|
|
*/ |
196
|
|
|
public function setTypeAnnotation(array $typeAnnotation) |
197
|
|
|
{ |
198
|
|
|
$this->typeAnnotation = $typeAnnotation; |
199
|
|
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
View Code Duplication |
public function isOK(&$msg = null) |
|
|
|
|
203
|
|
|
{ |
204
|
|
|
if (!$this->isValidArrayOK( |
205
|
|
|
$this->documentation, |
206
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType', |
207
|
|
|
$msg, |
208
|
|
|
0, |
209
|
|
|
1 |
210
|
|
|
)) { |
211
|
|
|
return false; |
212
|
|
|
} |
213
|
|
|
if (!$this->isValidArrayOK( |
214
|
|
|
$this->valueAnnotation, |
215
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TValueAnnotationType', |
216
|
|
|
$msg |
217
|
|
|
)) { |
218
|
|
|
return false; |
219
|
|
|
} |
220
|
|
|
if (!$this->isValidArrayOK( |
221
|
|
|
$this->typeAnnotation, |
222
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\TTypeAnnotationType', |
223
|
|
|
$msg |
224
|
|
|
)) { |
225
|
|
|
return false; |
226
|
|
|
} |
227
|
|
|
if (!$this->isTEntitySetAttributesOK($msg)) { |
228
|
|
|
return false; |
229
|
|
|
} |
230
|
|
|
return true; |
231
|
|
|
} |
232
|
|
|
} |
233
|
|
|
|
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.