1 | <?php |
||
13 | class StructAttribute extends AbstractModel |
||
14 | { |
||
15 | /** |
||
16 | * Type of the struct attribute |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $type = ''; |
||
20 | /** |
||
21 | * Defines that this property is not a simple value but an array of values |
||
22 | * Infos at {@link https://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints} |
||
23 | * @var bool |
||
24 | */ |
||
25 | protected $containsElements = false; |
||
26 | /** |
||
27 | * Defines that this property can be removed from request or not. |
||
28 | * The property cna be removed from the request (meaning from the Struct) as soon as the nillable=true && minOccurs=0 |
||
29 | * Infos at {@link http://www.w3schools.com/xml/el_element.asp} |
||
30 | * @var bool |
||
31 | */ |
||
32 | protected $removableFromRequest = false; |
||
33 | /** |
||
34 | * Main constructor |
||
35 | * @see AbstractModel::__construct() |
||
36 | * @uses StructAttribute::setType() |
||
37 | * @uses AbstractModel::setOwner() |
||
38 | * @param Generator $generator |
||
39 | * @param string $name the original name |
||
40 | * @param string $type the type |
||
41 | * @param Struct $struct defines the struct which owns this value |
||
42 | */ |
||
43 | 1155 | public function __construct(Generator $generator, $name, $type = '', Struct $struct = null) |
|
48 | /** |
||
49 | * Returns the unique name in the current struct (for setters/getters and struct constructor array) |
||
50 | * @uses AbstractModel::getCleanName() |
||
51 | * @uses AbstractModel::getName() |
||
52 | * @uses AbstractModel::uniqueName() |
||
53 | * @uses StructAttribute::getOwner() |
||
54 | * @param string $additionalContext |
||
55 | * @param string $string |
||
56 | * @param string $additionalContext |
||
57 | * @return string |
||
58 | */ |
||
59 | 175 | public function getUniqueString($string, $additionalContext= '') |
|
63 | /** |
||
64 | * Returns the unique name in the current struct (for setters/getters and struct contrusctor array) |
||
65 | * @uses AbstractModel::getCleanName() |
||
66 | * @uses AbstractModel::getName() |
||
67 | * @uses AbstractModel::uniqueName() |
||
68 | * @uses StructAttribute::getOwner() |
||
69 | * @param string $additionalContext |
||
70 | * @return string |
||
71 | */ |
||
72 | 175 | public function getUniqueName($additionalContext = '') |
|
76 | /** |
||
77 | * Returns the getter name for this attribute |
||
78 | * @uses StructAttribute::getUniqueName() |
||
79 | * @return string |
||
80 | */ |
||
81 | 170 | public function getGetterName() |
|
85 | /** |
||
86 | * Returns the getter name for this attribute |
||
87 | * @uses StructAttribute::getUniqueName() |
||
88 | * @return string |
||
89 | */ |
||
90 | 170 | public function getSetterName() |
|
94 | /** |
||
95 | * Returns the type value |
||
96 | * @return string |
||
97 | */ |
||
98 | 295 | public function getType($useTypeStruct = false) |
|
109 | /** |
||
110 | * Sets the type value |
||
111 | * @param string $type |
||
112 | * @return StructAttribute |
||
113 | */ |
||
114 | 1155 | public function setType($type) |
|
119 | /** |
||
120 | * Returns the type value |
||
121 | * @return bool |
||
122 | */ |
||
123 | 15 | public function getContainsElements() |
|
127 | /** |
||
128 | * Sets the type value |
||
129 | * @param bool $containsElements |
||
130 | * @return StructAttribute |
||
131 | */ |
||
132 | 455 | public function setContainsElements($containsElements) |
|
137 | /** |
||
138 | * @return bool |
||
139 | */ |
||
140 | 180 | public function getRemovableFromRequest() |
|
144 | /** |
||
145 | * @param bool $removableFromRequest |
||
146 | * @return StructAttribute |
||
147 | */ |
||
148 | 450 | public function setRemovableFromRequest($removableFromRequest) |
|
153 | /** |
||
154 | * If this attribute contains elements then it's an array |
||
155 | * only if its parent, the Struct, is not itself an array, |
||
156 | * if the parent is an array, then it is certainly not an array too |
||
157 | * @return bool |
||
158 | */ |
||
159 | 200 | public function isArray() |
|
163 | /** |
||
164 | * Returns potential default value |
||
165 | * @uses AbstractModel::getMetaValueFirstSet() |
||
166 | * @uses Utils::getValueWithinItsType() |
||
167 | * @uses StructAttribute::getType() |
||
168 | * @uses StructAttribute::getContainsElements() |
||
169 | * @return mixed |
||
170 | */ |
||
171 | 170 | public function getDefaultValue() |
|
184 | /** |
||
185 | * Returns true or false depending on minOccurs information associated to the attribute |
||
186 | * @uses AbstractModel::getMetaValueFirstSet() |
||
187 | * @uses AbstractModel::getMetaValue() |
||
188 | * @return bool true|false |
||
189 | */ |
||
190 | 165 | public function isRequired() |
|
199 | /** |
||
200 | * Returns the owner model object, meaning a Struct object |
||
201 | * @see AbstractModel::getOwner() |
||
202 | * @uses AbstractModel::getOwner() |
||
203 | * @return Struct |
||
204 | */ |
||
205 | 180 | public function getOwner() |
|
209 | /** |
||
210 | * @uses StructAttribute::getType() |
||
211 | * @return bool |
||
212 | */ |
||
213 | 165 | public function isXml() |
|
217 | /** |
||
218 | * @return Struct|null |
||
219 | */ |
||
220 | 270 | public function getTypeStruct() |
|
224 | /** |
||
225 | * @return string[] |
||
226 | */ |
||
227 | 230 | public function getTypeStructMeta() |
|
232 | /** |
||
233 | * @return bool |
||
234 | */ |
||
235 | 165 | public function isTypeStructArray() |
|
240 | /** |
||
241 | * @return Struct|null |
||
242 | */ |
||
243 | 230 | public function getInheritanceStruct() |
|
247 | /** |
||
248 | * @return string[] |
||
249 | */ |
||
250 | 230 | public function getInheritanceStructMeta() |
|
255 | /** |
||
256 | * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta() |
||
257 | * @return string[] |
||
258 | */ |
||
259 | 230 | public function getMeta() |
|
263 | /** |
||
264 | * @param $filename |
||
265 | * @return StructReservedMethod|StructArrayReservedMethod |
||
266 | */ |
||
267 | 175 | public function getReservedMethodsInstance($filename = null) |
|
271 | /** |
||
272 | * {@inheritDoc} |
||
273 | * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() |
||
274 | */ |
||
275 | 5 | protected function toJsonSerialize() |
|
283 | } |
||
284 |