1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TMultiplicityTrait; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TQualifiedNameTrait; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class representing TAssociationEndType |
12
|
|
|
* |
13
|
|
|
* |
14
|
|
|
* XSD Type: TAssociationEnd |
15
|
|
|
*/ |
16
|
|
|
class TAssociationEndType extends IsOK |
17
|
|
|
{ |
18
|
|
|
use TSimpleIdentifierTrait, TQualifiedNameTrait, TMultiplicityTrait; |
19
|
|
|
/** |
20
|
|
|
* @property string $type |
21
|
|
|
*/ |
22
|
|
|
private $type = null; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @property string $role |
26
|
|
|
*/ |
27
|
|
|
private $role = null; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @property string $multiplicity |
31
|
|
|
*/ |
32
|
|
|
private $multiplicity = null; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
36
|
|
|
*/ |
37
|
|
|
private $documentation = null; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TOnActionType[] $onDelete |
41
|
|
|
*/ |
42
|
|
|
private $onDelete = []; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Gets as type |
46
|
|
|
* |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
|
|
public function getType() |
50
|
|
|
{ |
51
|
|
|
return $this->type; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Sets a new type |
56
|
|
|
* |
57
|
|
|
* @param string $type |
58
|
|
|
* @return self |
59
|
|
|
*/ |
60
|
|
|
public function setType($type) |
61
|
|
|
{ |
62
|
|
|
$this->type = $type; |
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Gets as role |
68
|
|
|
* |
69
|
|
|
* @return string |
70
|
|
|
*/ |
71
|
|
|
public function getRole() |
72
|
|
|
{ |
73
|
|
|
return $this->role; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Sets a new role |
78
|
|
|
* |
79
|
|
|
* @param string $role |
80
|
|
|
* @return self |
81
|
|
|
*/ |
82
|
|
|
public function setRole($role) |
83
|
|
|
{ |
84
|
|
|
$this->role = $role; |
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Gets as multiplicity |
90
|
|
|
* |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
|
|
public function getMultiplicity() |
94
|
|
|
{ |
95
|
|
|
return $this->multiplicity; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Sets a new multiplicity |
100
|
|
|
* |
101
|
|
|
* @param string $multiplicity |
102
|
|
|
* @return self |
103
|
|
|
*/ |
104
|
|
|
public function setMultiplicity($multiplicity) |
105
|
|
|
{ |
106
|
|
|
$this->multiplicity = $multiplicity; |
107
|
|
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Gets as documentation |
112
|
|
|
* |
113
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType |
114
|
|
|
*/ |
115
|
|
|
public function getDocumentation() |
116
|
|
|
{ |
117
|
|
|
return $this->documentation; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Sets a new documentation |
122
|
|
|
* |
123
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
124
|
|
|
* @return self |
125
|
|
|
*/ |
126
|
|
|
public function setDocumentation(TDocumentationType $documentation) |
127
|
|
|
{ |
128
|
|
|
$this->documentation = $documentation; |
129
|
|
|
return $this; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Adds as onDelete |
134
|
|
|
* |
135
|
|
|
* @return self |
136
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TOnActionType $onDelete |
137
|
|
|
*/ |
138
|
|
|
public function addToOnDelete(TOnActionType $onDelete) |
139
|
|
|
{ |
140
|
|
|
$this->onDelete[] = $onDelete; |
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* isset onDelete |
146
|
|
|
* |
147
|
|
|
* @param scalar $index |
148
|
|
|
* @return boolean |
149
|
|
|
*/ |
150
|
|
|
public function issetOnDelete($index) |
151
|
|
|
{ |
152
|
|
|
return isset($this->onDelete[$index]); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* unset onDelete |
157
|
|
|
* |
158
|
|
|
* @param scalar $index |
159
|
|
|
* @return void |
160
|
|
|
*/ |
161
|
|
|
public function unsetOnDelete($index) |
162
|
|
|
{ |
163
|
|
|
unset($this->onDelete[$index]); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Gets as onDelete |
168
|
|
|
* |
169
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TOnActionType[] |
170
|
|
|
*/ |
171
|
|
|
public function getOnDelete() |
172
|
|
|
{ |
173
|
|
|
return $this->onDelete; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Sets a new onDelete |
178
|
|
|
* |
179
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TOnActionType[] $onDelete |
180
|
|
|
* @return self |
181
|
|
|
*/ |
182
|
|
|
public function setOnDelete(array $onDelete) |
183
|
|
|
{ |
184
|
|
|
$this->onDelete = $onDelete; |
185
|
|
|
return $this; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
public function isOK(&$msg = null) |
189
|
|
|
{ |
190
|
|
|
if (!$this->isStringNotNullOrEmpty($this->type)) { |
191
|
|
|
$msg = "Type cannot be null or empty"; |
192
|
|
|
return false; |
193
|
|
|
} |
194
|
|
|
if (!$this->isStringNotNullOrEmpty($this->multiplicity)) { |
195
|
|
|
$msg = "Multiplicity cannot be null or empty"; |
196
|
|
|
return false; |
197
|
|
|
} |
198
|
|
View Code Duplication |
if (null != $this->role && !$this->isStringNotNullOrEmpty($this->role)) { |
|
|
|
|
199
|
|
|
$msg = "Role cannot be empty"; |
200
|
|
|
return false; |
201
|
|
|
} |
202
|
|
|
if (null != $this->role && !$this->isTSimpleIdentifierValid($this->role)) { |
203
|
|
|
$msg = "Role must be a valid TSimpleIdentifier"; |
204
|
|
|
return false; |
205
|
|
|
} |
206
|
|
|
if (!$this->isTMultiplicityValid($this->multiplicity)) { |
207
|
|
|
$msg = "Multiplicity must be a valid TMultiplicity"; |
208
|
|
|
return false; |
209
|
|
|
} |
210
|
|
|
if (!$this->isValidArrayOK($this->onDelete, '\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TOnActionType', $msg)) { |
211
|
|
|
return false; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
return true; |
215
|
|
|
} |
216
|
|
|
} |
217
|
|
|
|
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.