1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of Smsa WebService package. |
5
|
|
|
* (c) Hamoud Alhoqbani <[email protected]> |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Alhoqbani\SmsaWebService\Soap\Type; |
11
|
|
|
|
12
|
|
|
use \WsdlToPhp\PackageBase\AbstractStructArrayBase; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* This class stands for ArrayOfOrderLineItem Type |
16
|
|
|
* |
17
|
|
|
* @date 2018/04/06 |
18
|
|
|
* @codeVersion 0.0.1 |
19
|
|
|
*/ |
20
|
|
|
class ArrayOfOrderLineItem extends AbstractStructArrayBase |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* The OrderLineItem |
24
|
|
|
* Meta informations extracted from the WSDL |
25
|
|
|
* - maxOccurs: unbounded |
26
|
|
|
* - minOccurs: 0 |
27
|
|
|
* - nillable: true |
28
|
|
|
* |
29
|
|
|
* @var \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem[] |
30
|
|
|
*/ |
31
|
|
|
public $OrderLineItem; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Constructor method for ArrayOfOrderLineItem |
35
|
|
|
* |
36
|
|
|
* @uses ArrayOfOrderLineItem::setOrderLineItem() |
37
|
|
|
* |
38
|
|
|
* @param \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem[] $orderLineItem |
39
|
|
|
*/ |
40
|
|
|
public function __construct(array $orderLineItem = []) |
41
|
|
|
{ |
42
|
|
|
$this |
43
|
|
|
->setOrderLineItem($orderLineItem); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get OrderLineItem value |
48
|
|
|
* An additional test has been added (isset) before returning the property value as |
49
|
|
|
* this property may have been unset before, due to the fact that this property is |
50
|
|
|
* removable from the request (nillable=true+minOccurs=0) |
51
|
|
|
* |
52
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem[]|null |
53
|
|
|
*/ |
54
|
|
|
public function getOrderLineItem() |
55
|
|
|
{ |
56
|
|
|
return isset($this->OrderLineItem) ? $this->OrderLineItem : null; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Set OrderLineItem value |
61
|
|
|
* This property is removable from request (nillable=true+minOccurs=0), therefore |
62
|
|
|
* if the value assigned to this property is null, it is removed from this object |
63
|
|
|
* |
64
|
|
|
* @param \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem[] $orderLineItem |
65
|
|
|
* |
66
|
|
|
* @throws \InvalidArgumentException |
67
|
|
|
* |
68
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\ArrayOfOrderLineItem |
69
|
|
|
*/ |
70
|
|
|
public function setOrderLineItem(array $orderLineItem = []) |
71
|
|
|
{ |
72
|
|
|
foreach ($orderLineItem as $arrayOfOrderLineItemOrderLineItemItem) { |
73
|
|
|
// validation for constraint: itemType |
74
|
|
View Code Duplication |
if (!$arrayOfOrderLineItemOrderLineItemItem instanceof \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem) { |
|
|
|
|
75
|
|
|
throw new \InvalidArgumentException(sprintf('The OrderLineItem property can only contain items of \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem, "%s" given', is_object($arrayOfOrderLineItemOrderLineItemItem) ? get_class($arrayOfOrderLineItemOrderLineItemItem) : gettype($arrayOfOrderLineItemOrderLineItemItem)), __LINE__); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
if (is_null($orderLineItem) || (is_array($orderLineItem) && empty($orderLineItem))) { |
79
|
|
|
unset($this->OrderLineItem); |
80
|
|
|
} else { |
81
|
|
|
$this->OrderLineItem = $orderLineItem; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Add item to OrderLineItem value |
89
|
|
|
* |
90
|
|
|
* @param \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem $item |
91
|
|
|
* |
92
|
|
|
* @throws \InvalidArgumentException |
93
|
|
|
* |
94
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\ArrayOfOrderLineItem |
95
|
|
|
*/ |
96
|
|
|
public function addToOrderLineItem(\Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem $item) |
97
|
|
|
{ |
98
|
|
|
// validation for constraint: itemType |
99
|
|
View Code Duplication |
if (!$item instanceof \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem) { |
|
|
|
|
100
|
|
|
throw new \InvalidArgumentException(sprintf('The OrderLineItem property can only contain items of \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__); |
101
|
|
|
} |
102
|
|
|
$this->OrderLineItem[] = $item; |
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Returns the current element |
109
|
|
|
* |
110
|
|
|
* @see AbstractStructArrayBase::current() |
111
|
|
|
* |
112
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem|null |
113
|
|
|
*/ |
114
|
|
|
public function current() |
115
|
|
|
{ |
116
|
|
|
return parent::current(); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Returns the indexed element |
121
|
|
|
* |
122
|
|
|
* @see AbstractStructArrayBase::item() |
123
|
|
|
* |
124
|
|
|
* @param int $index |
125
|
|
|
* |
126
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem|null |
127
|
|
|
*/ |
128
|
|
|
public function item($index) |
129
|
|
|
{ |
130
|
|
|
return parent::item($index); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Returns the first element |
135
|
|
|
* |
136
|
|
|
* @see AbstractStructArrayBase::first() |
137
|
|
|
* |
138
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem|null |
139
|
|
|
*/ |
140
|
|
|
public function first() |
141
|
|
|
{ |
142
|
|
|
return parent::first(); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Returns the last element |
147
|
|
|
* |
148
|
|
|
* @see AbstractStructArrayBase::last() |
149
|
|
|
* |
150
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem|null |
151
|
|
|
*/ |
152
|
|
|
public function last() |
153
|
|
|
{ |
154
|
|
|
return parent::last(); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Returns the element at the offset |
159
|
|
|
* |
160
|
|
|
* @see AbstractStructArrayBase::offsetGet() |
161
|
|
|
* |
162
|
|
|
* @param int $offset |
163
|
|
|
* |
164
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\OrderLineItem|null |
165
|
|
|
*/ |
166
|
|
|
public function offsetGet($offset) |
167
|
|
|
{ |
168
|
|
|
return parent::offsetGet($offset); |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* Returns the attribute name |
173
|
|
|
* |
174
|
|
|
* @see AbstractStructArrayBase::getAttributeName() |
175
|
|
|
* |
176
|
|
|
* @return string OrderLineItem |
177
|
|
|
*/ |
178
|
|
|
public function getAttributeName() |
179
|
|
|
{ |
180
|
|
|
return 'OrderLineItem'; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Method called when an object has been exported with var_export() functions |
185
|
|
|
* It allows to return an object instantiated with the values |
186
|
|
|
* |
187
|
|
|
* @see AbstractStructArrayBase::__set_state() |
188
|
|
|
* |
189
|
|
|
* @uses AbstractStructArrayBase::__set_state() |
190
|
|
|
* |
191
|
|
|
* @param array $array the exported values |
192
|
|
|
* |
193
|
|
|
* @return \Alhoqbani\SmsaWebService\Soap\Type\ArrayOfOrderLineItem |
194
|
|
|
*/ |
195
|
|
|
public static function __set_state(array $array) |
196
|
|
|
{ |
197
|
|
|
return parent::__set_state($array); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* Method returning the class name |
202
|
|
|
* |
203
|
|
|
* @return string __CLASS__ |
204
|
|
|
*/ |
205
|
|
|
public function __toString() |
206
|
|
|
{ |
207
|
|
|
return __CLASS__; |
208
|
|
|
} |
209
|
|
|
} |
210
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.