1 | <?php |
||
7 | class Struct extends AbstractModel |
||
8 | { |
||
9 | /** |
||
10 | * Only for virtually-considered objects (in order to avoid duplucations in objects property) |
||
11 | * @var array $virtualObjects |
||
12 | */ |
||
13 | protected $virtualObjects = []; |
||
14 | /** |
||
15 | * @see \WsdlToPhp\PackageGenerator\Container\Model\Model::objectClass() |
||
16 | * @return string |
||
17 | */ |
||
18 | 786 | protected function objectClass() |
|
22 | /** |
||
23 | * @param string $name |
||
24 | * @return Model|null |
||
25 | */ |
||
26 | 798 | public function getStructByName($name) |
|
30 | /** |
||
31 | * @param string $name |
||
32 | * @param string $type |
||
33 | * @return Model|null |
||
34 | */ |
||
35 | 354 | public function getStructByNameAndType($name, $type) |
|
39 | /** |
||
40 | * Adds a virtual struct |
||
41 | * @param string $structName the original struct name |
||
42 | * @param string $structType the original struct type |
||
43 | * @return Struct |
||
44 | */ |
||
45 | 294 | public function addVirtualStruct($structName, $structType = '') |
|
49 | /** |
||
50 | * Adds type to structs |
||
51 | * @param string $structName the original struct name |
||
52 | * @param bool $isStruct whether the Struct has to be generated or not |
||
53 | * @param string $structType the original struct type |
||
54 | * @return Struct |
||
55 | */ |
||
56 | 306 | public function addStruct($structName, $isStruct = true, $structType = '') |
|
64 | /** |
||
65 | * Adds type to structs and its attribute |
||
66 | * @param string $structName the original struct name |
||
67 | * @param string $attributeName the attribute name |
||
68 | * @param string $attributeType the attribute type |
||
69 | * @return Struct |
||
70 | */ |
||
71 | 306 | public function addStructWithAttribute($structName, $attributeName, $attributeType) |
|
79 | /** |
||
80 | * Adds a union struct |
||
81 | * @param string $structName |
||
82 | * @param string[] $types |
||
83 | * @return Struct |
||
84 | */ |
||
85 | 24 | public function addUnionStruct($structName, $types) |
|
93 | /** |
||
94 | * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::get() |
||
95 | * @param string $value |
||
96 | * @return Model|null |
||
97 | */ |
||
98 | 798 | public function get($value) |
|
102 | /** |
||
103 | * @see parent::get() |
||
104 | * @param string $value |
||
105 | * @return mixed |
||
106 | */ |
||
107 | 606 | public function getVirtual($value) |
|
115 | /** |
||
116 | * @see parent::get() |
||
117 | * @param string $value |
||
118 | * @param string $type |
||
119 | * @return mixed |
||
120 | */ |
||
121 | 558 | public function getByType($value, $type) |
|
132 | /** |
||
133 | * @param $object |
||
134 | * @param $type |
||
135 | * @return string |
||
136 | */ |
||
137 | 768 | public function getObjectKeyWithType($object, $type) |
|
141 | /** |
||
142 | * @param $object |
||
143 | * @param $type |
||
144 | * @return string |
||
145 | */ |
||
146 | 768 | public function getObjectKeyWithVirtual($object) |
|
150 | /** |
||
151 | * The key must not conflict with possible key values |
||
152 | * @param $name |
||
153 | * @param $type |
||
154 | * @return string |
||
155 | */ |
||
156 | 828 | public function getTypeKey($name, $type) |
|
160 | /** |
||
161 | * The key must not conflict with possible key values |
||
162 | * @param $type |
||
163 | * @return string |
||
164 | */ |
||
165 | 846 | public function getVirtualKey($name) |
|
169 | /** |
||
170 | * By overriding this method, we ensure that each time a new object is stored, it is stored with our new key if the inheritance is defined. |
||
171 | * @param Model $object |
||
172 | * @return Struct |
||
173 | */ |
||
174 | 792 | public function add($object) |
|
184 | } |
||
185 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.