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 | 1075 | 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 $additionnalContext |
||
55 | * @return string |
||
56 | */ |
||
57 | 165 | public function getUniqueName($additionnalContext = '') |
|
61 | /** |
||
62 | * Returns the getter name for this attribute |
||
63 | * @uses StructAttribute::getUniqueName() |
||
64 | * @return string |
||
65 | */ |
||
66 | 160 | public function getGetterName() |
|
70 | /** |
||
71 | * Returns the getter name for this attribute |
||
72 | * @uses StructAttribute::getUniqueName() |
||
73 | * @return string |
||
74 | */ |
||
75 | 160 | public function getSetterName() |
|
79 | /** |
||
80 | * Returns the type value |
||
81 | * @return string |
||
82 | */ |
||
83 | 470 | public function getType() |
|
87 | /** |
||
88 | * Sets the type value |
||
89 | * @param string $type |
||
90 | * @return StructAttribute |
||
91 | */ |
||
92 | 1075 | public function setType($type) |
|
97 | /** |
||
98 | * Returns the type value |
||
99 | * @return bool |
||
100 | */ |
||
101 | 15 | public function getContainsElements() |
|
105 | /** |
||
106 | * Sets the type value |
||
107 | * @param bool $containsElements |
||
108 | * @return StructAttribute |
||
109 | */ |
||
110 | 415 | public function setContainsElements($containsElements) |
|
115 | /** |
||
116 | * @return bool |
||
117 | */ |
||
118 | 170 | public function getRemovableFromRequest() |
|
122 | /** |
||
123 | * @param bool $removableFromRequest |
||
124 | * @return StructAttribute |
||
125 | */ |
||
126 | 410 | public function setRemovableFromRequest($removableFromRequest) |
|
131 | /** |
||
132 | * If this attribute contains elements then it's an array |
||
133 | * only if its parent, the Struct, is not itself an array, |
||
134 | * if the parent is an array, then it is certainly not an array too |
||
135 | * @return bool |
||
136 | */ |
||
137 | 155 | public function isArray() |
|
141 | /** |
||
142 | * Returns potential default value |
||
143 | * @uses AbstractModel::getMetaValueFirstSet() |
||
144 | * @uses Utils::getValueWithinItsType() |
||
145 | * @uses StructAttribute::getType() |
||
146 | * @uses StructAttribute::getContainsElements() |
||
147 | * @return mixed |
||
148 | */ |
||
149 | 155 | public function getDefaultValue() |
|
162 | /** |
||
163 | * Returns true or false depending on minOccurs information associated to the attribute |
||
164 | * @uses AbstractModel::getMetaValueFirstSet() |
||
165 | * @uses AbstractModel::getMetaValue() |
||
166 | * @return bool true|false |
||
167 | */ |
||
168 | 155 | public function isRequired() |
|
177 | /** |
||
178 | * Returns the owner model object, meaning a Struct object |
||
179 | * @see AbstractModel::getOwner() |
||
180 | * @uses AbstractModel::getOwner() |
||
181 | * @return Struct |
||
182 | */ |
||
183 | 170 | public function getOwner() |
|
187 | /** |
||
188 | * @uses StructAttribute::getType() |
||
189 | * @return bool |
||
190 | */ |
||
191 | 155 | public function isXml() |
|
195 | /** |
||
196 | * @return Struct|null |
||
197 | */ |
||
198 | 225 | public function getTypeStruct() |
|
202 | /** |
||
203 | * @return string[] |
||
204 | */ |
||
205 | 185 | public function getTypeStructMeta() |
|
210 | /** |
||
211 | * @return bool |
||
212 | */ |
||
213 | 120 | public function isTypeStructArray() |
|
218 | /** |
||
219 | * @return Struct|null |
||
220 | */ |
||
221 | 185 | public function getInheritanceStruct() |
|
225 | /** |
||
226 | * @return string[] |
||
227 | */ |
||
228 | 185 | public function getInheritanceStructMeta() |
|
233 | /** |
||
234 | * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta() |
||
235 | * @return string[] |
||
236 | */ |
||
237 | 185 | public function getMeta() |
|
241 | /** |
||
242 | * @param $filename |
||
243 | * @return StructReservedMethod|StructArrayReservedMethod |
||
244 | */ |
||
245 | 165 | public function getReservedMethodsInstance($filename = null) |
|
249 | /** |
||
250 | * {@inheritDoc} |
||
251 | * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize() |
||
252 | */ |
||
253 | 5 | protected function toJsonSerialize() |
|
261 | } |
||
262 |