1 | <?php |
||
13 | class StructAttribute extends AbstractModel |
||
14 | { |
||
15 | /** |
||
16 | * Type of the struct attribute |
||
17 | * @var string |
||
18 | */ |
||
19 | private $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 | private $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 | private $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 | 1145 | 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 contrusctor array) |
||
50 | * @uses AbstractModel::getCleanName() |
||
51 | * @uses AbstractModel::getName() |
||
52 | * @uses AbstractModel::uniqueName() |
||
53 | * @uses StructAttribute::getOwner() |
||
54 | * @param string $string |
||
55 | * @param string $additionnalContext |
||
56 | * @return string |
||
57 | */ |
||
58 | 170 | public function getUniqueString($string, $additionnalContext = '') |
|
62 | /** |
||
63 | * Returns the unique name in the current struct (for setters/getters and struct contrusctor array) |
||
64 | * @uses AbstractModel::getCleanName() |
||
65 | * @uses AbstractModel::getName() |
||
66 | * @uses AbstractModel::uniqueName() |
||
67 | * @uses StructAttribute::getOwner() |
||
68 | * @param string $additionnalContext |
||
69 | * @return string |
||
70 | */ |
||
71 | 170 | public function getUniqueName($additionnalContext = '') |
|
75 | /** |
||
76 | * Returns the getter name for this attribute |
||
77 | * @uses StructAttribute::getUniqueName() |
||
78 | * @return string |
||
79 | */ |
||
80 | 165 | public function getGetterName() |
|
84 | /** |
||
85 | * Returns the getter name for this attribute |
||
86 | * @uses StructAttribute::getUniqueName() |
||
87 | * @return string |
||
88 | */ |
||
89 | 165 | public function getSetterName() |
|
93 | /** |
||
94 | * Returns the type value |
||
95 | * @return string |
||
96 | */ |
||
97 | 280 | public function getType() |
|
101 | /** |
||
102 | * Sets the type value |
||
103 | * @param string $type |
||
104 | * @return StructAttribute |
||
105 | */ |
||
106 | 1145 | public function setType($type) |
|
111 | /** |
||
112 | * Returns the type value |
||
113 | * @return bool |
||
114 | */ |
||
115 | 15 | public function getContainsElements() |
|
119 | /** |
||
120 | * Sets the type value |
||
121 | * @param bool $containsElements |
||
122 | * @return StructAttribute |
||
123 | */ |
||
124 | 440 | public function setContainsElements($containsElements) |
|
129 | /** |
||
130 | * @return bool |
||
131 | */ |
||
132 | 175 | public function getRemovableFromRequest() |
|
136 | /** |
||
137 | * @param bool $removableFromRequest |
||
138 | * @return StructAttribute |
||
139 | */ |
||
140 | 435 | public function setRemovableFromRequest($removableFromRequest) |
|
145 | /** |
||
146 | * If this attribute contains elements then it's an array |
||
147 | * only if its parent, the Struct, is not itself an array, |
||
148 | * if the parent is an array, then it is certainly not an array too |
||
149 | * @return bool |
||
150 | */ |
||
151 | 190 | public function isArray() |
|
155 | /** |
||
156 | * Returns potential default value |
||
157 | * @uses AbstractModel::getMetaValueFirstSet() |
||
158 | * @uses Utils::getValueWithinItsType() |
||
159 | * @uses StructAttribute::getType() |
||
160 | * @uses StructAttribute::getContainsElements() |
||
161 | * @return mixed |
||
162 | */ |
||
163 | 160 | public function getDefaultValue() |
|
176 | /** |
||
177 | * Returns true or false depending on minOccurs information associated to the attribute |
||
178 | * @uses AbstractModel::getMetaValueFirstSet() |
||
179 | * @uses AbstractModel::getMetaValue() |
||
180 | * @return bool true|false |
||
181 | */ |
||
182 | 160 | public function isRequired() |
|
191 | /** |
||
192 | * Returns the owner model object, meaning a Struct object |
||
193 | * @see AbstractModel::getOwner() |
||
194 | * @uses AbstractModel::getOwner() |
||
195 | * @return Struct |
||
196 | */ |
||
197 | 175 | public function getOwner() |
|
201 | /** |
||
202 | * @uses StructAttribute::getType() |
||
203 | * @return bool |
||
204 | */ |
||
205 | 160 | public function isXml() |
|
209 | /** |
||
210 | * @return Struct|null |
||
211 | */ |
||
212 | 260 | public function getTypeStruct() |
|
216 | /** |
||
217 | * @return string[] |
||
218 | */ |
||
219 | 220 | public function getTypeStructMeta() |
|
224 | /** |
||
225 | * @return bool |
||
226 | */ |
||
227 | 155 | public function isTypeStructArray() |
|
232 | /** |
||
233 | * @return Struct|null |
||
234 | */ |
||
235 | 220 | public function getInheritanceStruct() |
|
239 | /** |
||
240 | * @return string[] |
||
241 | */ |
||
242 | 220 | public function getInheritanceStructMeta() |
|
247 | /** |
||
248 | * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta() |
||
249 | * @return string[] |
||
250 | */ |
||
251 | 220 | public function getMeta() |
|
255 | /** |
||
256 | * @param $filename |
||
257 | * @return StructReservedMethod|StructArrayReservedMethod |
||
258 | */ |
||
259 | 170 | public function getReservedMethodsInstance($filename = null) |
|
263 | /** |
||
264 | * {@inheritDoc} |
||
265 | * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() |
||
266 | */ |
||
267 | 5 | protected function toJsonSerialize() |
|
275 | } |
||
276 |