1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PayPal\StructType; |
4
|
|
|
|
5
|
|
|
use \WsdlToPhp\PackageBase\AbstractStructBase; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* This class stands for BMUpdateButtonRequestType StructType |
9
|
|
|
* @subpackage Structs |
10
|
|
|
* @author WsdlToPhp <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class BMUpdateButtonRequestType extends AbstractRequestType |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* The HostedButtonID |
16
|
|
|
* Meta information extracted from the WSDL |
17
|
|
|
* - documentation: Hosted Button id of the button to update. Required Character length and limitations: 10 single-byte numeric characters |
18
|
|
|
* - maxOccurs: 1 |
19
|
|
|
* - minOccurs: 1 |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
public $HostedButtonID; |
23
|
|
|
/** |
24
|
|
|
* The ButtonType |
25
|
|
|
* Meta information extracted from the WSDL |
26
|
|
|
* - documentation: Type of Button to create. Required Must be one of the following: BUYNOW, CART, GIFTCERTIFICATE. SUBSCRIBE, PAYMENTPLAN, AUTOBILLING, DONATE, VIEWCART or UNSUBSCRIBE |
27
|
|
|
* - maxOccurs: 1 |
28
|
|
|
* - minOccurs: 0 |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
public $ButtonType; |
32
|
|
|
/** |
33
|
|
|
* The ButtonCode |
34
|
|
|
* Meta information extracted from the WSDL |
35
|
|
|
* - documentation: button code. optional Must be one of the following: hosted, encrypted or cleartext |
36
|
|
|
* - maxOccurs: 1 |
37
|
|
|
* - minOccurs: 0 |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
public $ButtonCode; |
41
|
|
|
/** |
42
|
|
|
* The ButtonSubType |
43
|
|
|
* Meta information extracted from the WSDL |
44
|
|
|
* - documentation: Button sub type. optional for button types buynow and cart only Must Be either PRODUCTS or SERVICES |
45
|
|
|
* - maxOccurs: 1 |
46
|
|
|
* - minOccurs: 0 |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
public $ButtonSubType; |
50
|
|
|
/** |
51
|
|
|
* The ButtonVar |
52
|
|
|
* Meta information extracted from the WSDL |
53
|
|
|
* - documentation: Button Variable information At least one required recurring Character length and limitations: 63 single-byte alphanumeric characters |
54
|
|
|
* - maxOccurs: 1000 |
55
|
|
|
* - minOccurs: 0 |
56
|
|
|
* @var string[] |
57
|
|
|
*/ |
58
|
|
|
public $ButtonVar; |
59
|
|
|
/** |
60
|
|
|
* The OptionDetails |
61
|
|
|
* Meta information extracted from the WSDL |
62
|
|
|
* - maxOccurs: 5 |
63
|
|
|
* - minOccurs: 0 |
64
|
|
|
* @var \PayPal\StructType\OptionDetailsType[] |
65
|
|
|
*/ |
66
|
|
|
public $OptionDetails; |
67
|
|
|
/** |
68
|
|
|
* The TextBox |
69
|
|
|
* Meta information extracted from the WSDL |
70
|
|
|
* - documentation: Details of each option for the button. Optional |
71
|
|
|
* - maxOccurs: 2 |
72
|
|
|
* - minOccurs: 0 |
73
|
|
|
* @var string[] |
74
|
|
|
*/ |
75
|
|
|
public $TextBox; |
76
|
|
|
/** |
77
|
|
|
* The ButtonImage |
78
|
|
|
* Meta information extracted from the WSDL |
79
|
|
|
* - documentation: Button image to use. Optional Must be one of: REG, SML, or CC |
80
|
|
|
* - maxOccurs: 1 |
81
|
|
|
* - minOccurs: 0 |
82
|
|
|
* @var string |
83
|
|
|
*/ |
84
|
|
|
public $ButtonImage; |
85
|
|
|
/** |
86
|
|
|
* The ButtonImageURL |
87
|
|
|
* Meta information extracted from the WSDL |
88
|
|
|
* - documentation: Button URL for custom button image. Optional Character length and limitations: 127 single-byte alphanumeric characters |
89
|
|
|
* - maxOccurs: 1 |
90
|
|
|
* - minOccurs: 0 |
91
|
|
|
* @var string |
92
|
|
|
*/ |
93
|
|
|
public $ButtonImageURL; |
94
|
|
|
/** |
95
|
|
|
* The BuyNowText |
96
|
|
|
* Meta information extracted from the WSDL |
97
|
|
|
* - documentation: Text to use on Buy Now Button. Optional Must be either BUYNOW or PAYNOW |
98
|
|
|
* - maxOccurs: 1 |
99
|
|
|
* - minOccurs: 0 |
100
|
|
|
* @var string |
101
|
|
|
*/ |
102
|
|
|
public $BuyNowText; |
103
|
|
|
/** |
104
|
|
|
* The SubscribeText |
105
|
|
|
* Meta information extracted from the WSDL |
106
|
|
|
* - documentation: Text to use on Subscribe button. Optional Must be either BUYNOW or SUBSCRIBE |
107
|
|
|
* - maxOccurs: 1 |
108
|
|
|
* - minOccurs: 0 |
109
|
|
|
* @var string |
110
|
|
|
*/ |
111
|
|
|
public $SubscribeText; |
112
|
|
|
/** |
113
|
|
|
* The ButtonCountry |
114
|
|
|
* Meta information extracted from the WSDL |
115
|
|
|
* - documentation: Button Country. Optional Must be valid ISO country code |
116
|
|
|
* - maxOccurs: 1 |
117
|
|
|
* - minOccurs: 0 |
118
|
|
|
* @var string |
119
|
|
|
*/ |
120
|
|
|
public $ButtonCountry; |
121
|
|
|
/** |
122
|
|
|
* The ButtonLanguage |
123
|
|
|
* Meta information extracted from the WSDL |
124
|
|
|
* - documentation: Button language code. Optional Character length and limitations: 2 single-byte alphanumeric characters |
125
|
|
|
* - maxOccurs: 1 |
126
|
|
|
* - minOccurs: 0 |
127
|
|
|
* @var string |
128
|
|
|
*/ |
129
|
|
|
public $ButtonLanguage; |
130
|
|
|
/** |
131
|
|
|
* Constructor method for BMUpdateButtonRequestType |
132
|
|
|
* @uses BMUpdateButtonRequestType::setHostedButtonID() |
133
|
|
|
* @uses BMUpdateButtonRequestType::setButtonType() |
134
|
|
|
* @uses BMUpdateButtonRequestType::setButtonCode() |
135
|
|
|
* @uses BMUpdateButtonRequestType::setButtonSubType() |
136
|
|
|
* @uses BMUpdateButtonRequestType::setButtonVar() |
137
|
|
|
* @uses BMUpdateButtonRequestType::setOptionDetails() |
138
|
|
|
* @uses BMUpdateButtonRequestType::setTextBox() |
139
|
|
|
* @uses BMUpdateButtonRequestType::setButtonImage() |
140
|
|
|
* @uses BMUpdateButtonRequestType::setButtonImageURL() |
141
|
|
|
* @uses BMUpdateButtonRequestType::setBuyNowText() |
142
|
|
|
* @uses BMUpdateButtonRequestType::setSubscribeText() |
143
|
|
|
* @uses BMUpdateButtonRequestType::setButtonCountry() |
144
|
|
|
* @uses BMUpdateButtonRequestType::setButtonLanguage() |
145
|
|
|
* @param string $hostedButtonID |
146
|
|
|
* @param string $buttonType |
147
|
|
|
* @param string $buttonCode |
148
|
|
|
* @param string $buttonSubType |
149
|
|
|
* @param string[] $buttonVar |
150
|
|
|
* @param \PayPal\StructType\OptionDetailsType[] $optionDetails |
151
|
|
|
* @param string[] $textBox |
152
|
|
|
* @param string $buttonImage |
153
|
|
|
* @param string $buttonImageURL |
154
|
|
|
* @param string $buyNowText |
155
|
|
|
* @param string $subscribeText |
156
|
|
|
* @param string $buttonCountry |
157
|
|
|
* @param string $buttonLanguage |
158
|
|
|
*/ |
159
|
|
|
public function __construct($hostedButtonID = null, $buttonType = null, $buttonCode = null, $buttonSubType = null, array $buttonVar = array(), array $optionDetails = array(), array $textBox = array(), $buttonImage = null, $buttonImageURL = null, $buyNowText = null, $subscribeText = null, $buttonCountry = null, $buttonLanguage = null) |
160
|
|
|
{ |
161
|
|
|
$this |
162
|
|
|
->setHostedButtonID($hostedButtonID) |
163
|
|
|
->setButtonType($buttonType) |
164
|
|
|
->setButtonCode($buttonCode) |
165
|
|
|
->setButtonSubType($buttonSubType) |
166
|
|
|
->setButtonVar($buttonVar) |
167
|
|
|
->setOptionDetails($optionDetails) |
168
|
|
|
->setTextBox($textBox) |
169
|
|
|
->setButtonImage($buttonImage) |
170
|
|
|
->setButtonImageURL($buttonImageURL) |
171
|
|
|
->setBuyNowText($buyNowText) |
172
|
|
|
->setSubscribeText($subscribeText) |
173
|
|
|
->setButtonCountry($buttonCountry) |
174
|
|
|
->setButtonLanguage($buttonLanguage); |
175
|
|
|
} |
176
|
|
|
/** |
177
|
|
|
* Get HostedButtonID value |
178
|
|
|
* @return string |
179
|
|
|
*/ |
180
|
|
|
public function getHostedButtonID() |
181
|
|
|
{ |
182
|
|
|
return $this->HostedButtonID; |
183
|
|
|
} |
184
|
|
|
/** |
185
|
|
|
* Set HostedButtonID value |
186
|
|
|
* @param string $hostedButtonID |
187
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
188
|
|
|
*/ |
189
|
|
|
public function setHostedButtonID($hostedButtonID = null) |
190
|
|
|
{ |
191
|
|
|
// validation for constraint: string |
192
|
|
|
if (!is_null($hostedButtonID) && !is_string($hostedButtonID)) { |
|
|
|
|
193
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($hostedButtonID, true), gettype($hostedButtonID)), __LINE__); |
194
|
|
|
} |
195
|
|
|
$this->HostedButtonID = $hostedButtonID; |
196
|
|
|
return $this; |
197
|
|
|
} |
198
|
|
|
/** |
199
|
|
|
* Get ButtonType value |
200
|
|
|
* @return string|null |
201
|
|
|
*/ |
202
|
|
|
public function getButtonType() |
203
|
|
|
{ |
204
|
|
|
return $this->ButtonType; |
205
|
|
|
} |
206
|
|
|
/** |
207
|
|
|
* Set ButtonType value |
208
|
|
|
* @uses \PayPal\EnumType\ButtonTypeType::valueIsValid() |
209
|
|
|
* @uses \PayPal\EnumType\ButtonTypeType::getValidValues() |
210
|
|
|
* @throws \InvalidArgumentException |
211
|
|
|
* @param string $buttonType |
212
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
213
|
|
|
*/ |
214
|
|
|
public function setButtonType($buttonType = null) |
215
|
|
|
{ |
216
|
|
|
// validation for constraint: enumeration |
217
|
|
|
if (!\PayPal\EnumType\ButtonTypeType::valueIsValid($buttonType)) { |
218
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\ButtonTypeType', is_array($buttonType) ? implode(', ', $buttonType) : var_export($buttonType, true), implode(', ', \PayPal\EnumType\ButtonTypeType::getValidValues())), __LINE__); |
|
|
|
|
219
|
|
|
} |
220
|
|
|
$this->ButtonType = $buttonType; |
221
|
|
|
return $this; |
222
|
|
|
} |
223
|
|
|
/** |
224
|
|
|
* Get ButtonCode value |
225
|
|
|
* @return string|null |
226
|
|
|
*/ |
227
|
|
|
public function getButtonCode() |
228
|
|
|
{ |
229
|
|
|
return $this->ButtonCode; |
230
|
|
|
} |
231
|
|
|
/** |
232
|
|
|
* Set ButtonCode value |
233
|
|
|
* @uses \PayPal\EnumType\ButtonCodeType::valueIsValid() |
234
|
|
|
* @uses \PayPal\EnumType\ButtonCodeType::getValidValues() |
235
|
|
|
* @throws \InvalidArgumentException |
236
|
|
|
* @param string $buttonCode |
237
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
238
|
|
|
*/ |
239
|
|
|
public function setButtonCode($buttonCode = null) |
240
|
|
|
{ |
241
|
|
|
// validation for constraint: enumeration |
242
|
|
|
if (!\PayPal\EnumType\ButtonCodeType::valueIsValid($buttonCode)) { |
243
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\ButtonCodeType', is_array($buttonCode) ? implode(', ', $buttonCode) : var_export($buttonCode, true), implode(', ', \PayPal\EnumType\ButtonCodeType::getValidValues())), __LINE__); |
|
|
|
|
244
|
|
|
} |
245
|
|
|
$this->ButtonCode = $buttonCode; |
246
|
|
|
return $this; |
247
|
|
|
} |
248
|
|
|
/** |
249
|
|
|
* Get ButtonSubType value |
250
|
|
|
* @return string|null |
251
|
|
|
*/ |
252
|
|
|
public function getButtonSubType() |
253
|
|
|
{ |
254
|
|
|
return $this->ButtonSubType; |
255
|
|
|
} |
256
|
|
|
/** |
257
|
|
|
* Set ButtonSubType value |
258
|
|
|
* @uses \PayPal\EnumType\ButtonSubTypeType::valueIsValid() |
259
|
|
|
* @uses \PayPal\EnumType\ButtonSubTypeType::getValidValues() |
260
|
|
|
* @throws \InvalidArgumentException |
261
|
|
|
* @param string $buttonSubType |
262
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
263
|
|
|
*/ |
264
|
|
|
public function setButtonSubType($buttonSubType = null) |
265
|
|
|
{ |
266
|
|
|
// validation for constraint: enumeration |
267
|
|
|
if (!\PayPal\EnumType\ButtonSubTypeType::valueIsValid($buttonSubType)) { |
268
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\ButtonSubTypeType', is_array($buttonSubType) ? implode(', ', $buttonSubType) : var_export($buttonSubType, true), implode(', ', \PayPal\EnumType\ButtonSubTypeType::getValidValues())), __LINE__); |
|
|
|
|
269
|
|
|
} |
270
|
|
|
$this->ButtonSubType = $buttonSubType; |
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
/** |
274
|
|
|
* Get ButtonVar value |
275
|
|
|
* @return string[]|null |
276
|
|
|
*/ |
277
|
|
|
public function getButtonVar() |
278
|
|
|
{ |
279
|
|
|
return $this->ButtonVar; |
280
|
|
|
} |
281
|
|
|
/** |
282
|
|
|
* This method is responsible for validating the values passed to the setButtonVar method |
283
|
|
|
* This method is willingly generated in order to preserve the one-line inline validation within the setButtonVar method |
284
|
|
|
* @param array $values |
285
|
|
|
* @return string A non-empty message if the values does not match the validation rules |
286
|
|
|
*/ |
287
|
|
|
public static function validateButtonVarForArrayConstraintsFromSetButtonVar(array $values = array()) |
288
|
|
|
{ |
289
|
|
|
$message = ''; |
290
|
|
|
$invalidValues = []; |
291
|
|
|
foreach ($values as $bMUpdateButtonRequestTypeButtonVarItem) { |
292
|
|
|
// validation for constraint: itemType |
293
|
|
|
if (!is_string($bMUpdateButtonRequestTypeButtonVarItem)) { |
294
|
|
|
$invalidValues[] = is_object($bMUpdateButtonRequestTypeButtonVarItem) ? get_class($bMUpdateButtonRequestTypeButtonVarItem) : sprintf('%s(%s)', gettype($bMUpdateButtonRequestTypeButtonVarItem), var_export($bMUpdateButtonRequestTypeButtonVarItem, true)); |
295
|
|
|
} |
296
|
|
|
} |
297
|
|
|
if (!empty($invalidValues)) { |
298
|
|
|
$message = sprintf('The ButtonVar property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); |
|
|
|
|
299
|
|
|
} |
300
|
|
|
unset($invalidValues); |
301
|
|
|
return $message; |
302
|
|
|
} |
303
|
|
|
/** |
304
|
|
|
* Set ButtonVar value |
305
|
|
|
* @throws \InvalidArgumentException |
306
|
|
|
* @param string[] $buttonVar |
307
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
308
|
|
|
*/ |
309
|
|
|
public function setButtonVar(array $buttonVar = array()) |
310
|
|
|
{ |
311
|
|
|
// validation for constraint: array |
312
|
|
|
if ('' !== ($buttonVarArrayErrorMessage = self::validateButtonVarForArrayConstraintsFromSetButtonVar($buttonVar))) { |
313
|
|
|
throw new \InvalidArgumentException($buttonVarArrayErrorMessage, __LINE__); |
314
|
|
|
} |
315
|
|
|
// validation for constraint: maxOccurs(1000) |
316
|
|
|
if (is_array($buttonVar) && count($buttonVar) > 1000) { |
317
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 1000', count($buttonVar)), __LINE__); |
318
|
|
|
} |
319
|
|
|
$this->ButtonVar = $buttonVar; |
320
|
|
|
return $this; |
321
|
|
|
} |
322
|
|
|
/** |
323
|
|
|
* Add item to ButtonVar value |
324
|
|
|
* @throws \InvalidArgumentException |
325
|
|
|
* @param string $item |
326
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
327
|
|
|
*/ |
328
|
|
|
public function addToButtonVar($item) |
329
|
|
|
{ |
330
|
|
|
// validation for constraint: itemType |
331
|
|
|
if (!is_string($item)) { |
|
|
|
|
332
|
|
|
throw new \InvalidArgumentException(sprintf('The ButtonVar property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); |
333
|
|
|
} |
334
|
|
|
// validation for constraint: maxOccurs(1000) |
335
|
|
|
if (is_array($this->ButtonVar) && count($this->ButtonVar) >= 1000) { |
336
|
|
|
throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 1000', count($this->ButtonVar)), __LINE__); |
337
|
|
|
} |
338
|
|
|
$this->ButtonVar[] = $item; |
339
|
|
|
return $this; |
340
|
|
|
} |
341
|
|
|
/** |
342
|
|
|
* Get OptionDetails value |
343
|
|
|
* @return \PayPal\StructType\OptionDetailsType[]|null |
344
|
|
|
*/ |
345
|
|
|
public function getOptionDetails() |
346
|
|
|
{ |
347
|
|
|
return $this->OptionDetails; |
348
|
|
|
} |
349
|
|
|
/** |
350
|
|
|
* This method is responsible for validating the values passed to the setOptionDetails method |
351
|
|
|
* This method is willingly generated in order to preserve the one-line inline validation within the setOptionDetails method |
352
|
|
|
* @param array $values |
353
|
|
|
* @return string A non-empty message if the values does not match the validation rules |
354
|
|
|
*/ |
355
|
|
|
public static function validateOptionDetailsForArrayConstraintsFromSetOptionDetails(array $values = array()) |
356
|
|
|
{ |
357
|
|
|
$message = ''; |
358
|
|
|
$invalidValues = []; |
359
|
|
|
foreach ($values as $bMUpdateButtonRequestTypeOptionDetailsItem) { |
360
|
|
|
// validation for constraint: itemType |
361
|
|
|
if (!$bMUpdateButtonRequestTypeOptionDetailsItem instanceof \PayPal\StructType\OptionDetailsType) { |
362
|
|
|
$invalidValues[] = is_object($bMUpdateButtonRequestTypeOptionDetailsItem) ? get_class($bMUpdateButtonRequestTypeOptionDetailsItem) : sprintf('%s(%s)', gettype($bMUpdateButtonRequestTypeOptionDetailsItem), var_export($bMUpdateButtonRequestTypeOptionDetailsItem, true)); |
363
|
|
|
} |
364
|
|
|
} |
365
|
|
|
if (!empty($invalidValues)) { |
366
|
|
|
$message = sprintf('The OptionDetails property can only contain items of type \PayPal\StructType\OptionDetailsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); |
|
|
|
|
367
|
|
|
} |
368
|
|
|
unset($invalidValues); |
369
|
|
|
return $message; |
370
|
|
|
} |
371
|
|
|
/** |
372
|
|
|
* Set OptionDetails value |
373
|
|
|
* @throws \InvalidArgumentException |
374
|
|
|
* @param \PayPal\StructType\OptionDetailsType[] $optionDetails |
375
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
376
|
|
|
*/ |
377
|
|
|
public function setOptionDetails(array $optionDetails = array()) |
378
|
|
|
{ |
379
|
|
|
// validation for constraint: array |
380
|
|
|
if ('' !== ($optionDetailsArrayErrorMessage = self::validateOptionDetailsForArrayConstraintsFromSetOptionDetails($optionDetails))) { |
381
|
|
|
throw new \InvalidArgumentException($optionDetailsArrayErrorMessage, __LINE__); |
382
|
|
|
} |
383
|
|
|
// validation for constraint: maxOccurs(5) |
384
|
|
|
if (is_array($optionDetails) && count($optionDetails) > 5) { |
385
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 5', count($optionDetails)), __LINE__); |
386
|
|
|
} |
387
|
|
|
$this->OptionDetails = $optionDetails; |
388
|
|
|
return $this; |
389
|
|
|
} |
390
|
|
|
/** |
391
|
|
|
* Add item to OptionDetails value |
392
|
|
|
* @throws \InvalidArgumentException |
393
|
|
|
* @param \PayPal\StructType\OptionDetailsType $item |
394
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
395
|
|
|
*/ |
396
|
|
|
public function addToOptionDetails(\PayPal\StructType\OptionDetailsType $item) |
397
|
|
|
{ |
398
|
|
|
// validation for constraint: itemType |
399
|
|
|
if (!$item instanceof \PayPal\StructType\OptionDetailsType) { |
|
|
|
|
400
|
|
|
throw new \InvalidArgumentException(sprintf('The OptionDetails property can only contain items of type \PayPal\StructType\OptionDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); |
401
|
|
|
} |
402
|
|
|
// validation for constraint: maxOccurs(5) |
403
|
|
|
if (is_array($this->OptionDetails) && count($this->OptionDetails) >= 5) { |
404
|
|
|
throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 5', count($this->OptionDetails)), __LINE__); |
405
|
|
|
} |
406
|
|
|
$this->OptionDetails[] = $item; |
407
|
|
|
return $this; |
408
|
|
|
} |
409
|
|
|
/** |
410
|
|
|
* Get TextBox value |
411
|
|
|
* @return string[]|null |
412
|
|
|
*/ |
413
|
|
|
public function getTextBox() |
414
|
|
|
{ |
415
|
|
|
return $this->TextBox; |
416
|
|
|
} |
417
|
|
|
/** |
418
|
|
|
* This method is responsible for validating the values passed to the setTextBox method |
419
|
|
|
* This method is willingly generated in order to preserve the one-line inline validation within the setTextBox method |
420
|
|
|
* @param array $values |
421
|
|
|
* @return string A non-empty message if the values does not match the validation rules |
422
|
|
|
*/ |
423
|
|
|
public static function validateTextBoxForArrayConstraintsFromSetTextBox(array $values = array()) |
424
|
|
|
{ |
425
|
|
|
$message = ''; |
426
|
|
|
$invalidValues = []; |
427
|
|
|
foreach ($values as $bMUpdateButtonRequestTypeTextBoxItem) { |
428
|
|
|
// validation for constraint: itemType |
429
|
|
|
if (!is_string($bMUpdateButtonRequestTypeTextBoxItem)) { |
430
|
|
|
$invalidValues[] = is_object($bMUpdateButtonRequestTypeTextBoxItem) ? get_class($bMUpdateButtonRequestTypeTextBoxItem) : sprintf('%s(%s)', gettype($bMUpdateButtonRequestTypeTextBoxItem), var_export($bMUpdateButtonRequestTypeTextBoxItem, true)); |
431
|
|
|
} |
432
|
|
|
} |
433
|
|
|
if (!empty($invalidValues)) { |
434
|
|
|
$message = sprintf('The TextBox property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); |
|
|
|
|
435
|
|
|
} |
436
|
|
|
unset($invalidValues); |
437
|
|
|
return $message; |
438
|
|
|
} |
439
|
|
|
/** |
440
|
|
|
* Set TextBox value |
441
|
|
|
* @throws \InvalidArgumentException |
442
|
|
|
* @param string[] $textBox |
443
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
444
|
|
|
*/ |
445
|
|
|
public function setTextBox(array $textBox = array()) |
446
|
|
|
{ |
447
|
|
|
// validation for constraint: array |
448
|
|
|
if ('' !== ($textBoxArrayErrorMessage = self::validateTextBoxForArrayConstraintsFromSetTextBox($textBox))) { |
449
|
|
|
throw new \InvalidArgumentException($textBoxArrayErrorMessage, __LINE__); |
450
|
|
|
} |
451
|
|
|
// validation for constraint: maxOccurs(2) |
452
|
|
|
if (is_array($textBox) && count($textBox) > 2) { |
453
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 2', count($textBox)), __LINE__); |
454
|
|
|
} |
455
|
|
|
$this->TextBox = $textBox; |
456
|
|
|
return $this; |
457
|
|
|
} |
458
|
|
|
/** |
459
|
|
|
* Add item to TextBox value |
460
|
|
|
* @throws \InvalidArgumentException |
461
|
|
|
* @param string $item |
462
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
463
|
|
|
*/ |
464
|
|
|
public function addToTextBox($item) |
465
|
|
|
{ |
466
|
|
|
// validation for constraint: itemType |
467
|
|
|
if (!is_string($item)) { |
|
|
|
|
468
|
|
|
throw new \InvalidArgumentException(sprintf('The TextBox property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); |
469
|
|
|
} |
470
|
|
|
// validation for constraint: maxOccurs(2) |
471
|
|
|
if (is_array($this->TextBox) && count($this->TextBox) >= 2) { |
472
|
|
|
throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 2', count($this->TextBox)), __LINE__); |
473
|
|
|
} |
474
|
|
|
$this->TextBox[] = $item; |
475
|
|
|
return $this; |
476
|
|
|
} |
477
|
|
|
/** |
478
|
|
|
* Get ButtonImage value |
479
|
|
|
* @return string|null |
480
|
|
|
*/ |
481
|
|
|
public function getButtonImage() |
482
|
|
|
{ |
483
|
|
|
return $this->ButtonImage; |
484
|
|
|
} |
485
|
|
|
/** |
486
|
|
|
* Set ButtonImage value |
487
|
|
|
* @uses \PayPal\EnumType\ButtonImageType::valueIsValid() |
488
|
|
|
* @uses \PayPal\EnumType\ButtonImageType::getValidValues() |
489
|
|
|
* @throws \InvalidArgumentException |
490
|
|
|
* @param string $buttonImage |
491
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
492
|
|
|
*/ |
493
|
|
|
public function setButtonImage($buttonImage = null) |
494
|
|
|
{ |
495
|
|
|
// validation for constraint: enumeration |
496
|
|
|
if (!\PayPal\EnumType\ButtonImageType::valueIsValid($buttonImage)) { |
497
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\ButtonImageType', is_array($buttonImage) ? implode(', ', $buttonImage) : var_export($buttonImage, true), implode(', ', \PayPal\EnumType\ButtonImageType::getValidValues())), __LINE__); |
|
|
|
|
498
|
|
|
} |
499
|
|
|
$this->ButtonImage = $buttonImage; |
500
|
|
|
return $this; |
501
|
|
|
} |
502
|
|
|
/** |
503
|
|
|
* Get ButtonImageURL value |
504
|
|
|
* @return string|null |
505
|
|
|
*/ |
506
|
|
|
public function getButtonImageURL() |
507
|
|
|
{ |
508
|
|
|
return $this->ButtonImageURL; |
509
|
|
|
} |
510
|
|
|
/** |
511
|
|
|
* Set ButtonImageURL value |
512
|
|
|
* @param string $buttonImageURL |
513
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
514
|
|
|
*/ |
515
|
|
|
public function setButtonImageURL($buttonImageURL = null) |
516
|
|
|
{ |
517
|
|
|
// validation for constraint: string |
518
|
|
|
if (!is_null($buttonImageURL) && !is_string($buttonImageURL)) { |
|
|
|
|
519
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buttonImageURL, true), gettype($buttonImageURL)), __LINE__); |
520
|
|
|
} |
521
|
|
|
$this->ButtonImageURL = $buttonImageURL; |
522
|
|
|
return $this; |
523
|
|
|
} |
524
|
|
|
/** |
525
|
|
|
* Get BuyNowText value |
526
|
|
|
* @return string|null |
527
|
|
|
*/ |
528
|
|
|
public function getBuyNowText() |
529
|
|
|
{ |
530
|
|
|
return $this->BuyNowText; |
531
|
|
|
} |
532
|
|
|
/** |
533
|
|
|
* Set BuyNowText value |
534
|
|
|
* @uses \PayPal\EnumType\BuyNowTextType::valueIsValid() |
535
|
|
|
* @uses \PayPal\EnumType\BuyNowTextType::getValidValues() |
536
|
|
|
* @throws \InvalidArgumentException |
537
|
|
|
* @param string $buyNowText |
538
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
539
|
|
|
*/ |
540
|
|
|
public function setBuyNowText($buyNowText = null) |
541
|
|
|
{ |
542
|
|
|
// validation for constraint: enumeration |
543
|
|
|
if (!\PayPal\EnumType\BuyNowTextType::valueIsValid($buyNowText)) { |
544
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\BuyNowTextType', is_array($buyNowText) ? implode(', ', $buyNowText) : var_export($buyNowText, true), implode(', ', \PayPal\EnumType\BuyNowTextType::getValidValues())), __LINE__); |
|
|
|
|
545
|
|
|
} |
546
|
|
|
$this->BuyNowText = $buyNowText; |
547
|
|
|
return $this; |
548
|
|
|
} |
549
|
|
|
/** |
550
|
|
|
* Get SubscribeText value |
551
|
|
|
* @return string|null |
552
|
|
|
*/ |
553
|
|
|
public function getSubscribeText() |
554
|
|
|
{ |
555
|
|
|
return $this->SubscribeText; |
556
|
|
|
} |
557
|
|
|
/** |
558
|
|
|
* Set SubscribeText value |
559
|
|
|
* @uses \PayPal\EnumType\SubscribeTextType::valueIsValid() |
560
|
|
|
* @uses \PayPal\EnumType\SubscribeTextType::getValidValues() |
561
|
|
|
* @throws \InvalidArgumentException |
562
|
|
|
* @param string $subscribeText |
563
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
564
|
|
|
*/ |
565
|
|
|
public function setSubscribeText($subscribeText = null) |
566
|
|
|
{ |
567
|
|
|
// validation for constraint: enumeration |
568
|
|
|
if (!\PayPal\EnumType\SubscribeTextType::valueIsValid($subscribeText)) { |
569
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\SubscribeTextType', is_array($subscribeText) ? implode(', ', $subscribeText) : var_export($subscribeText, true), implode(', ', \PayPal\EnumType\SubscribeTextType::getValidValues())), __LINE__); |
|
|
|
|
570
|
|
|
} |
571
|
|
|
$this->SubscribeText = $subscribeText; |
572
|
|
|
return $this; |
573
|
|
|
} |
574
|
|
|
/** |
575
|
|
|
* Get ButtonCountry value |
576
|
|
|
* @return string|null |
577
|
|
|
*/ |
578
|
|
|
public function getButtonCountry() |
579
|
|
|
{ |
580
|
|
|
return $this->ButtonCountry; |
581
|
|
|
} |
582
|
|
|
/** |
583
|
|
|
* Set ButtonCountry value |
584
|
|
|
* @uses \PayPal\EnumType\CountryCodeType::valueIsValid() |
585
|
|
|
* @uses \PayPal\EnumType\CountryCodeType::getValidValues() |
586
|
|
|
* @throws \InvalidArgumentException |
587
|
|
|
* @param string $buttonCountry |
588
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
589
|
|
|
*/ |
590
|
|
|
public function setButtonCountry($buttonCountry = null) |
591
|
|
|
{ |
592
|
|
|
// validation for constraint: enumeration |
593
|
|
|
if (!\PayPal\EnumType\CountryCodeType::valueIsValid($buttonCountry)) { |
594
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\CountryCodeType', is_array($buttonCountry) ? implode(', ', $buttonCountry) : var_export($buttonCountry, true), implode(', ', \PayPal\EnumType\CountryCodeType::getValidValues())), __LINE__); |
|
|
|
|
595
|
|
|
} |
596
|
|
|
$this->ButtonCountry = $buttonCountry; |
597
|
|
|
return $this; |
598
|
|
|
} |
599
|
|
|
/** |
600
|
|
|
* Get ButtonLanguage value |
601
|
|
|
* @return string|null |
602
|
|
|
*/ |
603
|
|
|
public function getButtonLanguage() |
604
|
|
|
{ |
605
|
|
|
return $this->ButtonLanguage; |
606
|
|
|
} |
607
|
|
|
/** |
608
|
|
|
* Set ButtonLanguage value |
609
|
|
|
* @param string $buttonLanguage |
610
|
|
|
* @return \PayPal\StructType\BMUpdateButtonRequestType |
611
|
|
|
*/ |
612
|
|
|
public function setButtonLanguage($buttonLanguage = null) |
613
|
|
|
{ |
614
|
|
|
// validation for constraint: string |
615
|
|
|
if (!is_null($buttonLanguage) && !is_string($buttonLanguage)) { |
|
|
|
|
616
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buttonLanguage, true), gettype($buttonLanguage)), __LINE__); |
617
|
|
|
} |
618
|
|
|
$this->ButtonLanguage = $buttonLanguage; |
619
|
|
|
return $this; |
620
|
|
|
} |
621
|
|
|
} |
622
|
|
|
|