1 | <?php |
||
11 | class StructAttribute extends AbstractModel |
||
12 | { |
||
13 | /** |
||
14 | * Type of the struct attribute |
||
15 | * @var string |
||
16 | */ |
||
17 | private $type = ''; |
||
18 | /** |
||
19 | * Defines that this property is not a simple value but an array of values |
||
20 | * Infos at {@link https://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints} |
||
21 | * @var string |
||
22 | */ |
||
23 | private $containsElements = false; |
||
24 | /** |
||
25 | * Main constructor |
||
26 | * @see AbstractModel::__construct() |
||
27 | * @uses StructAttribute::setType() |
||
28 | * @uses AbstractModel::setOwner() |
||
29 | * @param Generator $generator |
||
30 | * @param string $name the original name |
||
31 | * @param string $type the type |
||
32 | * @param Struct $struct defines the struct which owns this value |
||
33 | */ |
||
34 | 380 | public function __construct(Generator $generator, $name, $type, Struct $struct) |
|
40 | /** |
||
41 | * Returns the unique name in the current struct (for setters/getters and struct contrusctor array) |
||
42 | * @uses AbstractModel::getCleanName() |
||
43 | * @uses AbstractModel::getName() |
||
44 | * @uses AbstractModel::uniqueName() |
||
45 | * @uses StructAttribute::getOwner() |
||
46 | * @return string |
||
47 | */ |
||
48 | 72 | public function getUniqueName() |
|
52 | /** |
||
53 | * Returns the getter name for this attribute |
||
54 | * @uses StructAttribute::getUniqueName() |
||
55 | * @return string |
||
56 | */ |
||
57 | 68 | public function getGetterName() |
|
61 | /** |
||
62 | * Returns the getter name for this attribute |
||
63 | * @uses StructAttribute::getUniqueName() |
||
64 | * @return string |
||
65 | */ |
||
66 | 68 | public function getSetterName() |
|
70 | /** |
||
71 | * Returns the type value |
||
72 | * @return string |
||
73 | */ |
||
74 | 244 | public function getType() |
|
78 | /** |
||
79 | * Sets the type value |
||
80 | * @param string $type |
||
81 | * @return StructAttribute |
||
82 | */ |
||
83 | 380 | public function setType($type) |
|
88 | /** |
||
89 | * Returns the type value |
||
90 | * @return string |
||
91 | */ |
||
92 | 4 | public function getContainsElements() |
|
96 | /** |
||
97 | * Sets the type value |
||
98 | * @param bool $containsElements |
||
99 | * @return string |
||
100 | */ |
||
101 | 232 | public function setContainsElements($containsElements) |
|
106 | /** |
||
107 | * Returns potential default value |
||
108 | * @uses AbstractModel::getMetaValueFirstSet() |
||
109 | * @uses Utils::getValueWithinItsType() |
||
110 | * @uses StructAttribute::getType() |
||
111 | * @return mixed |
||
112 | */ |
||
113 | 48 | public function getDefaultValue() |
|
123 | /** |
||
124 | * Returns true or false depending on minOccurs information associated to the attribute |
||
125 | * @uses AbstractModel::getMetaValueFirstSet() |
||
126 | * @uses AbstractModel::getMetaValue() |
||
127 | * @return bool true|false |
||
128 | */ |
||
129 | 68 | public function isRequired() |
|
138 | /** |
||
139 | * Returns the owner model object, meaning a Struct object |
||
140 | * @see AbstractModel::getOwner() |
||
141 | * @uses AbstractModel::getOwner() |
||
142 | * @return Struct |
||
143 | */ |
||
144 | 72 | public function getOwner() |
|
148 | /** |
||
149 | * @return bool |
||
150 | */ |
||
151 | 68 | public function isXml() |
|
155 | } |
||
156 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.