__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 25
c 1
b 0
f 0
nc 1
nop 24
dl 0
loc 27
rs 9.52

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace PayPal\StructType;
4
5
use \WsdlToPhp\PackageBase\AbstractStructBase;
6
7
/**
8
 * This class stands for DoExpressCheckoutPaymentRequestDetailsType StructType
9
 * @subpackage Structs
10
 * @author WsdlToPhp <[email protected]>
11
 */
12
class DoExpressCheckoutPaymentRequestDetailsType extends AbstractStructBase
13
{
14
    /**
15
     * The PaymentAction
16
     * Meta information extracted from the WSDL
17
     * - documentation: How you want to obtain payment. Required Authorization indicates that this payment is a basic authorization subject to settlement with PayPal Authorization and Capture. Order indicates that this payment is is an order authorization
18
     * subject to settlement with PayPal Authorization and Capture. Sale indicates that this is a final sale for which you are requesting payment. IMPORTANT: You cannot set PaymentAction to Sale on SetExpressCheckoutRequest and then change PaymentAction to
19
     * Authorization on the final Express Checkout API, DoExpressCheckoutPaymentRequest. Character length and limit: Up to 13 single-byte alphabetic characters
20
     * - maxOccurs: 1
21
     * - minOccurs: 0
22
     * @var string
23
     */
24
    public $PaymentAction;
25
    /**
26
     * The Token
27
     * Meta information extracted from the WSDL
28
     * - documentation: The timestamped token value that was returned by SetExpressCheckoutResponse and passed on GetExpressCheckoutDetailsRequest. Required Character length and limitations: 20 single-byte characters
29
     * - base: xs:string
30
     * @var string
31
     */
32
    public $Token;
33
    /**
34
     * The PayerID
35
     * Meta information extracted from the WSDL
36
     * - documentation: Encrypted PayPal customer account identification number as returned by GetExpressCheckoutDetailsResponse. Required Character length and limitations: 127 single-byte characters.
37
     * - base: xs:string
38
     * - maxLength: 127
39
     * @var string
40
     */
41
    public $PayerID;
42
    /**
43
     * The OrderURL
44
     * Meta information extracted from the WSDL
45
     * - documentation: URL on Merchant site pertaining to this invoice. Optional
46
     * - maxOccurs: 1
47
     * - minOccurs: 0
48
     * @var string
49
     */
50
    public $OrderURL;
51
    /**
52
     * The MsgSubID
53
     * Meta information extracted from the WSDL
54
     * - documentation: Unique id for each API request to prevent duplicate payments on merchant side. Passed directly back to merchant in response. Optional Character length and limits: 38 single-byte characters maximum.
55
     * - maxOccurs: 1
56
     * - minOccurs: 0
57
     * @var string
58
     */
59
    public $MsgSubID;
60
    /**
61
     * The PaymentDetails
62
     * Meta information extracted from the WSDL
63
     * - documentation: Information about the payment Required
64
     * - maxOccurs: 10
65
     * - minOccurs: 0
66
     * @var \PayPal\StructType\PaymentDetailsType[]
67
     */
68
    public $PaymentDetails;
69
    /**
70
     * The PromoOverrideFlag
71
     * Meta information extracted from the WSDL
72
     * - documentation: Flag to indicate if previously set promoCode shall be overriden. Value 1 indicates overriding.
73
     * - maxOccurs: 1
74
     * - minOccurs: 0
75
     * @var string
76
     */
77
    public $PromoOverrideFlag;
78
    /**
79
     * The PromoCode
80
     * Meta information extracted from the WSDL
81
     * - documentation: Promotional financing code for item. Overrides any previous PromoCode setting.
82
     * - maxOccurs: 1
83
     * - minOccurs: 0
84
     * @var string
85
     */
86
    public $PromoCode;
87
    /**
88
     * The EnhancedData
89
     * Meta information extracted from the WSDL
90
     * - documentation: Contains data for enhanced data like Airline Itinerary Data. This tag became Obsolete on or after 62 version, use EnhancedPaymentData instead.
91
     * - maxOccurs: 1
92
     * - minOccurs: 0
93
     * @var \PayPal\StructType\EnhancedDataType
94
     */
95
    public $EnhancedData;
96
    /**
97
     * The SoftDescriptor
98
     * Meta information extracted from the WSDL
99
     * - documentation: Soft Descriptor supported for Sale and Auth in DEC only. For Order this will be ignored.
100
     * - minOccurs: 0
101
     * @var string
102
     */
103
    public $SoftDescriptor;
104
    /**
105
     * The UserSelectedOptions
106
     * Meta information extracted from the WSDL
107
     * - documentation: Information about the user selected options.
108
     * - maxOccurs: 1
109
     * - minOccurs: 0
110
     * @var \PayPal\StructType\UserSelectedOptionType
111
     */
112
    public $UserSelectedOptions;
113
    /**
114
     * The GiftMessage
115
     * Meta information extracted from the WSDL
116
     * - documentation: Information about the Gift message.
117
     * - maxOccurs: 1
118
     * - minOccurs: 0
119
     * @var string
120
     */
121
    public $GiftMessage;
122
    /**
123
     * The GiftReceiptEnable
124
     * Meta information extracted from the WSDL
125
     * - documentation: Information about the Gift receipt enable.
126
     * - maxOccurs: 1
127
     * - minOccurs: 0
128
     * @var string
129
     */
130
    public $GiftReceiptEnable;
131
    /**
132
     * The GiftWrapName
133
     * Meta information extracted from the WSDL
134
     * - documentation: Information about the Gift Wrap name.
135
     * - maxOccurs: 1
136
     * - minOccurs: 0
137
     * @var string
138
     */
139
    public $GiftWrapName;
140
    /**
141
     * The GiftWrapAmount
142
     * Meta information extracted from the WSDL
143
     * - documentation: Information about the Gift Wrap amount.
144
     * - maxOccurs: 1
145
     * - minOccurs: 0
146
     * @var \PayPal\StructType\BasicAmountType
147
     */
148
    public $GiftWrapAmount;
149
    /**
150
     * The BuyerMarketingEmail
151
     * Meta information extracted from the WSDL
152
     * - documentation: Information about the Buyer marketing email.
153
     * - maxOccurs: 1
154
     * - minOccurs: 0
155
     * @var string
156
     */
157
    public $BuyerMarketingEmail;
158
    /**
159
     * The SurveyQuestion
160
     * Meta information extracted from the WSDL
161
     * - documentation: Information about the survey question.
162
     * - maxOccurs: 1
163
     * - minOccurs: 0
164
     * @var string
165
     */
166
    public $SurveyQuestion;
167
    /**
168
     * The SurveyChoiceSelected
169
     * Meta information extracted from the WSDL
170
     * - documentation: Information about the survey choice selected by the user.
171
     * - maxOccurs: unbounded
172
     * - minOccurs: 0
173
     * @var string[]
174
     */
175
    public $SurveyChoiceSelected;
176
    /**
177
     * The ButtonSource
178
     * Meta information extracted from the WSDL
179
     * - documentation: An identification code for use by third-party applications to identify transactions. Optional Character length and limitations: 32 single-byte alphanumeric characters
180
     * - minOccurs: 0
181
     * @var string
182
     */
183
    public $ButtonSource;
184
    /**
185
     * The SkipBACreation
186
     * Meta information extracted from the WSDL
187
     * - documentation: Merchant specified flag which indicates whether to create billing agreement as part of DoEC or not. Optional
188
     * - maxOccurs: 1
189
     * - minOccurs: 0
190
     * @var bool
191
     */
192
    public $SkipBACreation;
193
    /**
194
     * The UseSessionPaymentDetails
195
     * Meta information extracted from the WSDL
196
     * - documentation: Merchant specified flag which indicates to use payment details from session if available. Optional
197
     * - maxOccurs: 1
198
     * - minOccurs: 0
199
     * @var string
200
     */
201
    public $UseSessionPaymentDetails;
202
    /**
203
     * The CoupledBuckets
204
     * Meta information extracted from the WSDL
205
     * - documentation: Optional element that defines relationship between buckets
206
     * - maxOccurs: 5
207
     * - minOccurs: 0
208
     * @var \PayPal\StructType\CoupledBucketsType[]
209
     */
210
    public $CoupledBuckets;
211
    /**
212
     * The ClientID
213
     * Meta information extracted from the WSDL
214
     * - documentation: Optional element for the passing client id
215
     * - maxOccurs: 1
216
     * - minOccurs: 0
217
     * @var string
218
     */
219
    public $ClientID;
220
    /**
221
     * The ProductLine
222
     * Meta information extracted from the WSDL
223
     * - documentation: Optional element for the passing product lines
224
     * - maxOccurs: 1
225
     * - minOccurs: 0
226
     * @var string
227
     */
228
    public $ProductLine;
229
    /**
230
     * Constructor method for DoExpressCheckoutPaymentRequestDetailsType
231
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setPaymentAction()
232
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setToken()
233
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setPayerID()
234
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setOrderURL()
235
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setMsgSubID()
236
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setPaymentDetails()
237
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setPromoOverrideFlag()
238
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setPromoCode()
239
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setEnhancedData()
240
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setSoftDescriptor()
241
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setUserSelectedOptions()
242
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setGiftMessage()
243
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setGiftReceiptEnable()
244
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setGiftWrapName()
245
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setGiftWrapAmount()
246
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setBuyerMarketingEmail()
247
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setSurveyQuestion()
248
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setSurveyChoiceSelected()
249
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setButtonSource()
250
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setSkipBACreation()
251
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setUseSessionPaymentDetails()
252
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setCoupledBuckets()
253
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setClientID()
254
     * @uses DoExpressCheckoutPaymentRequestDetailsType::setProductLine()
255
     * @param string $paymentAction
256
     * @param string $token
257
     * @param string $payerID
258
     * @param string $orderURL
259
     * @param string $msgSubID
260
     * @param \PayPal\StructType\PaymentDetailsType[] $paymentDetails
261
     * @param string $promoOverrideFlag
262
     * @param string $promoCode
263
     * @param \PayPal\StructType\EnhancedDataType $enhancedData
264
     * @param string $softDescriptor
265
     * @param \PayPal\StructType\UserSelectedOptionType $userSelectedOptions
266
     * @param string $giftMessage
267
     * @param string $giftReceiptEnable
268
     * @param string $giftWrapName
269
     * @param \PayPal\StructType\BasicAmountType $giftWrapAmount
270
     * @param string $buyerMarketingEmail
271
     * @param string $surveyQuestion
272
     * @param string[] $surveyChoiceSelected
273
     * @param string $buttonSource
274
     * @param bool $skipBACreation
275
     * @param string $useSessionPaymentDetails
276
     * @param \PayPal\StructType\CoupledBucketsType[] $coupledBuckets
277
     * @param string $clientID
278
     * @param string $productLine
279
     */
280
    public function __construct($paymentAction = null, $token = null, $payerID = null, $orderURL = null, $msgSubID = null, array $paymentDetails = array(), $promoOverrideFlag = null, $promoCode = null, \PayPal\StructType\EnhancedDataType $enhancedData = null, $softDescriptor = null, \PayPal\StructType\UserSelectedOptionType $userSelectedOptions = null, $giftMessage = null, $giftReceiptEnable = null, $giftWrapName = null, \PayPal\StructType\BasicAmountType $giftWrapAmount = null, $buyerMarketingEmail = null, $surveyQuestion = null, array $surveyChoiceSelected = array(), $buttonSource = null, $skipBACreation = null, $useSessionPaymentDetails = null, array $coupledBuckets = array(), $clientID = null, $productLine = null)
281
    {
282
        $this
283
            ->setPaymentAction($paymentAction)
284
            ->setToken($token)
285
            ->setPayerID($payerID)
286
            ->setOrderURL($orderURL)
287
            ->setMsgSubID($msgSubID)
288
            ->setPaymentDetails($paymentDetails)
289
            ->setPromoOverrideFlag($promoOverrideFlag)
290
            ->setPromoCode($promoCode)
291
            ->setEnhancedData($enhancedData)
292
            ->setSoftDescriptor($softDescriptor)
293
            ->setUserSelectedOptions($userSelectedOptions)
294
            ->setGiftMessage($giftMessage)
295
            ->setGiftReceiptEnable($giftReceiptEnable)
296
            ->setGiftWrapName($giftWrapName)
297
            ->setGiftWrapAmount($giftWrapAmount)
298
            ->setBuyerMarketingEmail($buyerMarketingEmail)
299
            ->setSurveyQuestion($surveyQuestion)
300
            ->setSurveyChoiceSelected($surveyChoiceSelected)
301
            ->setButtonSource($buttonSource)
302
            ->setSkipBACreation($skipBACreation)
303
            ->setUseSessionPaymentDetails($useSessionPaymentDetails)
304
            ->setCoupledBuckets($coupledBuckets)
305
            ->setClientID($clientID)
306
            ->setProductLine($productLine);
307
    }
308
    /**
309
     * Get PaymentAction value
310
     * @return string|null
311
     */
312
    public function getPaymentAction()
313
    {
314
        return $this->PaymentAction;
315
    }
316
    /**
317
     * Set PaymentAction value
318
     * @uses \PayPal\EnumType\PaymentActionCodeType::valueIsValid()
319
     * @uses \PayPal\EnumType\PaymentActionCodeType::getValidValues()
320
     * @throws \InvalidArgumentException
321
     * @param string $paymentAction
322
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
323
     */
324
    public function setPaymentAction($paymentAction = null)
325
    {
326
        // validation for constraint: enumeration
327
        if (!\PayPal\EnumType\PaymentActionCodeType::valueIsValid($paymentAction)) {
328
            throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\PaymentActionCodeType', is_array($paymentAction) ? implode(', ', $paymentAction) : var_export($paymentAction, true), implode(', ', \PayPal\EnumType\PaymentActionCodeType::getValidValues())), __LINE__);
0 ignored issues
show
introduced by
The condition is_array($paymentAction) is always false.
Loading history...
329
        }
330
        $this->PaymentAction = $paymentAction;
331
        return $this;
332
    }
333
    /**
334
     * Get Token value
335
     * @return string|null
336
     */
337
    public function getToken()
338
    {
339
        return $this->Token;
340
    }
341
    /**
342
     * Set Token value
343
     * @param string $token
344
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
345
     */
346
    public function setToken($token = null)
347
    {
348
        // validation for constraint: string
349
        if (!is_null($token) && !is_string($token)) {
0 ignored issues
show
introduced by
The condition is_string($token) is always true.
Loading history...
350
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($token, true), gettype($token)), __LINE__);
351
        }
352
        $this->Token = $token;
353
        return $this;
354
    }
355
    /**
356
     * Get PayerID value
357
     * @return string|null
358
     */
359
    public function getPayerID()
360
    {
361
        return $this->PayerID;
362
    }
363
    /**
364
     * Set PayerID value
365
     * @param string $payerID
366
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
367
     */
368
    public function setPayerID($payerID = null)
369
    {
370
        // validation for constraint: string
371
        if (!is_null($payerID) && !is_string($payerID)) {
0 ignored issues
show
introduced by
The condition is_string($payerID) is always true.
Loading history...
372
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($payerID, true), gettype($payerID)), __LINE__);
373
        }
374
        // validation for constraint: maxLength(127)
375
        if (!is_null($payerID) && mb_strlen($payerID) > 127) {
376
            throw new \InvalidArgumentException(sprintf('Invalid length of %s, the number of characters/octets contained by the literal must be less than or equal to 127', mb_strlen($payerID)), __LINE__);
377
        }
378
        $this->PayerID = $payerID;
379
        return $this;
380
    }
381
    /**
382
     * Get OrderURL value
383
     * @return string|null
384
     */
385
    public function getOrderURL()
386
    {
387
        return $this->OrderURL;
388
    }
389
    /**
390
     * Set OrderURL value
391
     * @param string $orderURL
392
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
393
     */
394
    public function setOrderURL($orderURL = null)
395
    {
396
        // validation for constraint: string
397
        if (!is_null($orderURL) && !is_string($orderURL)) {
0 ignored issues
show
introduced by
The condition is_string($orderURL) is always true.
Loading history...
398
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($orderURL, true), gettype($orderURL)), __LINE__);
399
        }
400
        $this->OrderURL = $orderURL;
401
        return $this;
402
    }
403
    /**
404
     * Get MsgSubID value
405
     * @return string|null
406
     */
407
    public function getMsgSubID()
408
    {
409
        return $this->MsgSubID;
410
    }
411
    /**
412
     * Set MsgSubID value
413
     * @param string $msgSubID
414
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
415
     */
416
    public function setMsgSubID($msgSubID = null)
417
    {
418
        // validation for constraint: string
419
        if (!is_null($msgSubID) && !is_string($msgSubID)) {
0 ignored issues
show
introduced by
The condition is_string($msgSubID) is always true.
Loading history...
420
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($msgSubID, true), gettype($msgSubID)), __LINE__);
421
        }
422
        $this->MsgSubID = $msgSubID;
423
        return $this;
424
    }
425
    /**
426
     * Get PaymentDetails value
427
     * @return \PayPal\StructType\PaymentDetailsType[]|null
428
     */
429
    public function getPaymentDetails()
430
    {
431
        return $this->PaymentDetails;
432
    }
433
    /**
434
     * This method is responsible for validating the values passed to the setPaymentDetails method
435
     * This method is willingly generated in order to preserve the one-line inline validation within the setPaymentDetails method
436
     * @param array $values
437
     * @return string A non-empty message if the values does not match the validation rules
438
     */
439
    public static function validatePaymentDetailsForArrayConstraintsFromSetPaymentDetails(array $values = array())
440
    {
441
        $message = '';
442
        $invalidValues = [];
443
        foreach ($values as $doExpressCheckoutPaymentRequestDetailsTypePaymentDetailsItem) {
444
            // validation for constraint: itemType
445
            if (!$doExpressCheckoutPaymentRequestDetailsTypePaymentDetailsItem instanceof \PayPal\StructType\PaymentDetailsType) {
446
                $invalidValues[] = is_object($doExpressCheckoutPaymentRequestDetailsTypePaymentDetailsItem) ? get_class($doExpressCheckoutPaymentRequestDetailsTypePaymentDetailsItem) : sprintf('%s(%s)', gettype($doExpressCheckoutPaymentRequestDetailsTypePaymentDetailsItem), var_export($doExpressCheckoutPaymentRequestDetailsTypePaymentDetailsItem, true));
447
            }
448
        }
449
        if (!empty($invalidValues)) {
450
            $message = sprintf('The PaymentDetails property can only contain items of type \PayPal\StructType\PaymentDetailsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
0 ignored issues
show
introduced by
The condition is_array($invalidValues) is always true.
Loading history...
introduced by
The condition is_object($invalidValues) is always false.
Loading history...
451
        }
452
        unset($invalidValues);
453
        return $message;
454
    }
455
    /**
456
     * Set PaymentDetails value
457
     * @throws \InvalidArgumentException
458
     * @param \PayPal\StructType\PaymentDetailsType[] $paymentDetails
459
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
460
     */
461
    public function setPaymentDetails(array $paymentDetails = array())
462
    {
463
        // validation for constraint: array
464
        if ('' !== ($paymentDetailsArrayErrorMessage = self::validatePaymentDetailsForArrayConstraintsFromSetPaymentDetails($paymentDetails))) {
465
            throw new \InvalidArgumentException($paymentDetailsArrayErrorMessage, __LINE__);
466
        }
467
        // validation for constraint: maxOccurs(10)
468
        if (is_array($paymentDetails) && count($paymentDetails) > 10) {
469
            throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 10', count($paymentDetails)), __LINE__);
470
        }
471
        $this->PaymentDetails = $paymentDetails;
472
        return $this;
473
    }
474
    /**
475
     * Add item to PaymentDetails value
476
     * @throws \InvalidArgumentException
477
     * @param \PayPal\StructType\PaymentDetailsType $item
478
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
479
     */
480
    public function addToPaymentDetails(\PayPal\StructType\PaymentDetailsType $item)
481
    {
482
        // validation for constraint: itemType
483
        if (!$item instanceof \PayPal\StructType\PaymentDetailsType) {
0 ignored issues
show
introduced by
$item is always a sub-type of PayPal\StructType\PaymentDetailsType.
Loading history...
484
            throw new \InvalidArgumentException(sprintf('The PaymentDetails property can only contain items of type \PayPal\StructType\PaymentDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
485
        }
486
        // validation for constraint: maxOccurs(10)
487
        if (is_array($this->PaymentDetails) && count($this->PaymentDetails) >= 10) {
488
            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 10', count($this->PaymentDetails)), __LINE__);
489
        }
490
        $this->PaymentDetails[] = $item;
491
        return $this;
492
    }
493
    /**
494
     * Get PromoOverrideFlag value
495
     * @return string|null
496
     */
497
    public function getPromoOverrideFlag()
498
    {
499
        return $this->PromoOverrideFlag;
500
    }
501
    /**
502
     * Set PromoOverrideFlag value
503
     * @param string $promoOverrideFlag
504
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
505
     */
506
    public function setPromoOverrideFlag($promoOverrideFlag = null)
507
    {
508
        // validation for constraint: string
509
        if (!is_null($promoOverrideFlag) && !is_string($promoOverrideFlag)) {
0 ignored issues
show
introduced by
The condition is_string($promoOverrideFlag) is always true.
Loading history...
510
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($promoOverrideFlag, true), gettype($promoOverrideFlag)), __LINE__);
511
        }
512
        $this->PromoOverrideFlag = $promoOverrideFlag;
513
        return $this;
514
    }
515
    /**
516
     * Get PromoCode value
517
     * @return string|null
518
     */
519
    public function getPromoCode()
520
    {
521
        return $this->PromoCode;
522
    }
523
    /**
524
     * Set PromoCode value
525
     * @param string $promoCode
526
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
527
     */
528
    public function setPromoCode($promoCode = null)
529
    {
530
        // validation for constraint: string
531
        if (!is_null($promoCode) && !is_string($promoCode)) {
0 ignored issues
show
introduced by
The condition is_string($promoCode) is always true.
Loading history...
532
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($promoCode, true), gettype($promoCode)), __LINE__);
533
        }
534
        $this->PromoCode = $promoCode;
535
        return $this;
536
    }
537
    /**
538
     * Get EnhancedData value
539
     * @return \PayPal\StructType\EnhancedDataType|null
540
     */
541
    public function getEnhancedData()
542
    {
543
        return $this->EnhancedData;
544
    }
545
    /**
546
     * Set EnhancedData value
547
     * @param \PayPal\StructType\EnhancedDataType $enhancedData
548
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
549
     */
550
    public function setEnhancedData(\PayPal\StructType\EnhancedDataType $enhancedData = null)
551
    {
552
        $this->EnhancedData = $enhancedData;
553
        return $this;
554
    }
555
    /**
556
     * Get SoftDescriptor value
557
     * @return string|null
558
     */
559
    public function getSoftDescriptor()
560
    {
561
        return $this->SoftDescriptor;
562
    }
563
    /**
564
     * Set SoftDescriptor value
565
     * @param string $softDescriptor
566
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
567
     */
568
    public function setSoftDescriptor($softDescriptor = null)
569
    {
570
        // validation for constraint: string
571
        if (!is_null($softDescriptor) && !is_string($softDescriptor)) {
0 ignored issues
show
introduced by
The condition is_string($softDescriptor) is always true.
Loading history...
572
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($softDescriptor, true), gettype($softDescriptor)), __LINE__);
573
        }
574
        $this->SoftDescriptor = $softDescriptor;
575
        return $this;
576
    }
577
    /**
578
     * Get UserSelectedOptions value
579
     * @return \PayPal\StructType\UserSelectedOptionType|null
580
     */
581
    public function getUserSelectedOptions()
582
    {
583
        return $this->UserSelectedOptions;
584
    }
585
    /**
586
     * Set UserSelectedOptions value
587
     * @param \PayPal\StructType\UserSelectedOptionType $userSelectedOptions
588
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
589
     */
590
    public function setUserSelectedOptions(\PayPal\StructType\UserSelectedOptionType $userSelectedOptions = null)
591
    {
592
        $this->UserSelectedOptions = $userSelectedOptions;
593
        return $this;
594
    }
595
    /**
596
     * Get GiftMessage value
597
     * @return string|null
598
     */
599
    public function getGiftMessage()
600
    {
601
        return $this->GiftMessage;
602
    }
603
    /**
604
     * Set GiftMessage value
605
     * @param string $giftMessage
606
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
607
     */
608
    public function setGiftMessage($giftMessage = null)
609
    {
610
        // validation for constraint: string
611
        if (!is_null($giftMessage) && !is_string($giftMessage)) {
0 ignored issues
show
introduced by
The condition is_string($giftMessage) is always true.
Loading history...
612
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftMessage, true), gettype($giftMessage)), __LINE__);
613
        }
614
        $this->GiftMessage = $giftMessage;
615
        return $this;
616
    }
617
    /**
618
     * Get GiftReceiptEnable value
619
     * @return string|null
620
     */
621
    public function getGiftReceiptEnable()
622
    {
623
        return $this->GiftReceiptEnable;
624
    }
625
    /**
626
     * Set GiftReceiptEnable value
627
     * @param string $giftReceiptEnable
628
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
629
     */
630
    public function setGiftReceiptEnable($giftReceiptEnable = null)
631
    {
632
        // validation for constraint: string
633
        if (!is_null($giftReceiptEnable) && !is_string($giftReceiptEnable)) {
0 ignored issues
show
introduced by
The condition is_string($giftReceiptEnable) is always true.
Loading history...
634
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftReceiptEnable, true), gettype($giftReceiptEnable)), __LINE__);
635
        }
636
        $this->GiftReceiptEnable = $giftReceiptEnable;
637
        return $this;
638
    }
639
    /**
640
     * Get GiftWrapName value
641
     * @return string|null
642
     */
643
    public function getGiftWrapName()
644
    {
645
        return $this->GiftWrapName;
646
    }
647
    /**
648
     * Set GiftWrapName value
649
     * @param string $giftWrapName
650
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
651
     */
652
    public function setGiftWrapName($giftWrapName = null)
653
    {
654
        // validation for constraint: string
655
        if (!is_null($giftWrapName) && !is_string($giftWrapName)) {
0 ignored issues
show
introduced by
The condition is_string($giftWrapName) is always true.
Loading history...
656
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftWrapName, true), gettype($giftWrapName)), __LINE__);
657
        }
658
        $this->GiftWrapName = $giftWrapName;
659
        return $this;
660
    }
661
    /**
662
     * Get GiftWrapAmount value
663
     * @return \PayPal\StructType\BasicAmountType|null
664
     */
665
    public function getGiftWrapAmount()
666
    {
667
        return $this->GiftWrapAmount;
668
    }
669
    /**
670
     * Set GiftWrapAmount value
671
     * @param \PayPal\StructType\BasicAmountType $giftWrapAmount
672
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
673
     */
674
    public function setGiftWrapAmount(\PayPal\StructType\BasicAmountType $giftWrapAmount = null)
675
    {
676
        $this->GiftWrapAmount = $giftWrapAmount;
677
        return $this;
678
    }
679
    /**
680
     * Get BuyerMarketingEmail value
681
     * @return string|null
682
     */
683
    public function getBuyerMarketingEmail()
684
    {
685
        return $this->BuyerMarketingEmail;
686
    }
687
    /**
688
     * Set BuyerMarketingEmail value
689
     * @param string $buyerMarketingEmail
690
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
691
     */
692
    public function setBuyerMarketingEmail($buyerMarketingEmail = null)
693
    {
694
        // validation for constraint: string
695
        if (!is_null($buyerMarketingEmail) && !is_string($buyerMarketingEmail)) {
0 ignored issues
show
introduced by
The condition is_string($buyerMarketingEmail) is always true.
Loading history...
696
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buyerMarketingEmail, true), gettype($buyerMarketingEmail)), __LINE__);
697
        }
698
        $this->BuyerMarketingEmail = $buyerMarketingEmail;
699
        return $this;
700
    }
701
    /**
702
     * Get SurveyQuestion value
703
     * @return string|null
704
     */
705
    public function getSurveyQuestion()
706
    {
707
        return $this->SurveyQuestion;
708
    }
709
    /**
710
     * Set SurveyQuestion value
711
     * @param string $surveyQuestion
712
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
713
     */
714
    public function setSurveyQuestion($surveyQuestion = null)
715
    {
716
        // validation for constraint: string
717
        if (!is_null($surveyQuestion) && !is_string($surveyQuestion)) {
0 ignored issues
show
introduced by
The condition is_string($surveyQuestion) is always true.
Loading history...
718
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($surveyQuestion, true), gettype($surveyQuestion)), __LINE__);
719
        }
720
        $this->SurveyQuestion = $surveyQuestion;
721
        return $this;
722
    }
723
    /**
724
     * Get SurveyChoiceSelected value
725
     * @return string[]|null
726
     */
727
    public function getSurveyChoiceSelected()
728
    {
729
        return $this->SurveyChoiceSelected;
730
    }
731
    /**
732
     * This method is responsible for validating the values passed to the setSurveyChoiceSelected method
733
     * This method is willingly generated in order to preserve the one-line inline validation within the setSurveyChoiceSelected method
734
     * @param array $values
735
     * @return string A non-empty message if the values does not match the validation rules
736
     */
737
    public static function validateSurveyChoiceSelectedForArrayConstraintsFromSetSurveyChoiceSelected(array $values = array())
738
    {
739
        $message = '';
740
        $invalidValues = [];
741
        foreach ($values as $doExpressCheckoutPaymentRequestDetailsTypeSurveyChoiceSelectedItem) {
742
            // validation for constraint: itemType
743
            if (!is_string($doExpressCheckoutPaymentRequestDetailsTypeSurveyChoiceSelectedItem)) {
744
                $invalidValues[] = is_object($doExpressCheckoutPaymentRequestDetailsTypeSurveyChoiceSelectedItem) ? get_class($doExpressCheckoutPaymentRequestDetailsTypeSurveyChoiceSelectedItem) : sprintf('%s(%s)', gettype($doExpressCheckoutPaymentRequestDetailsTypeSurveyChoiceSelectedItem), var_export($doExpressCheckoutPaymentRequestDetailsTypeSurveyChoiceSelectedItem, true));
745
            }
746
        }
747
        if (!empty($invalidValues)) {
748
            $message = sprintf('The SurveyChoiceSelected property can only contain items of type string, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
0 ignored issues
show
introduced by
The condition is_array($invalidValues) is always true.
Loading history...
introduced by
The condition is_object($invalidValues) is always false.
Loading history...
749
        }
750
        unset($invalidValues);
751
        return $message;
752
    }
753
    /**
754
     * Set SurveyChoiceSelected value
755
     * @throws \InvalidArgumentException
756
     * @param string[] $surveyChoiceSelected
757
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
758
     */
759
    public function setSurveyChoiceSelected(array $surveyChoiceSelected = array())
760
    {
761
        // validation for constraint: array
762
        if ('' !== ($surveyChoiceSelectedArrayErrorMessage = self::validateSurveyChoiceSelectedForArrayConstraintsFromSetSurveyChoiceSelected($surveyChoiceSelected))) {
763
            throw new \InvalidArgumentException($surveyChoiceSelectedArrayErrorMessage, __LINE__);
764
        }
765
        $this->SurveyChoiceSelected = $surveyChoiceSelected;
766
        return $this;
767
    }
768
    /**
769
     * Add item to SurveyChoiceSelected value
770
     * @throws \InvalidArgumentException
771
     * @param string $item
772
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
773
     */
774
    public function addToSurveyChoiceSelected($item)
775
    {
776
        // validation for constraint: itemType
777
        if (!is_string($item)) {
0 ignored issues
show
introduced by
The condition is_string($item) is always true.
Loading history...
778
            throw new \InvalidArgumentException(sprintf('The SurveyChoiceSelected property can only contain items of type string, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
779
        }
780
        $this->SurveyChoiceSelected[] = $item;
781
        return $this;
782
    }
783
    /**
784
     * Get ButtonSource value
785
     * @return string|null
786
     */
787
    public function getButtonSource()
788
    {
789
        return $this->ButtonSource;
790
    }
791
    /**
792
     * Set ButtonSource value
793
     * @param string $buttonSource
794
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
795
     */
796
    public function setButtonSource($buttonSource = null)
797
    {
798
        // validation for constraint: string
799
        if (!is_null($buttonSource) && !is_string($buttonSource)) {
0 ignored issues
show
introduced by
The condition is_string($buttonSource) is always true.
Loading history...
800
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buttonSource, true), gettype($buttonSource)), __LINE__);
801
        }
802
        $this->ButtonSource = $buttonSource;
803
        return $this;
804
    }
805
    /**
806
     * Get SkipBACreation value
807
     * @return bool|null
808
     */
809
    public function getSkipBACreation()
810
    {
811
        return $this->SkipBACreation;
812
    }
813
    /**
814
     * Set SkipBACreation value
815
     * @param bool $skipBACreation
816
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
817
     */
818
    public function setSkipBACreation($skipBACreation = null)
819
    {
820
        // validation for constraint: boolean
821
        if (!is_null($skipBACreation) && !is_bool($skipBACreation)) {
0 ignored issues
show
introduced by
The condition is_bool($skipBACreation) is always true.
Loading history...
822
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($skipBACreation, true), gettype($skipBACreation)), __LINE__);
823
        }
824
        $this->SkipBACreation = $skipBACreation;
825
        return $this;
826
    }
827
    /**
828
     * Get UseSessionPaymentDetails value
829
     * @return string|null
830
     */
831
    public function getUseSessionPaymentDetails()
832
    {
833
        return $this->UseSessionPaymentDetails;
834
    }
835
    /**
836
     * Set UseSessionPaymentDetails value
837
     * @param string $useSessionPaymentDetails
838
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
839
     */
840
    public function setUseSessionPaymentDetails($useSessionPaymentDetails = null)
841
    {
842
        // validation for constraint: string
843
        if (!is_null($useSessionPaymentDetails) && !is_string($useSessionPaymentDetails)) {
0 ignored issues
show
introduced by
The condition is_string($useSessionPaymentDetails) is always true.
Loading history...
844
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($useSessionPaymentDetails, true), gettype($useSessionPaymentDetails)), __LINE__);
845
        }
846
        $this->UseSessionPaymentDetails = $useSessionPaymentDetails;
847
        return $this;
848
    }
849
    /**
850
     * Get CoupledBuckets value
851
     * @return \PayPal\StructType\CoupledBucketsType[]|null
852
     */
853
    public function getCoupledBuckets()
854
    {
855
        return $this->CoupledBuckets;
856
    }
857
    /**
858
     * This method is responsible for validating the values passed to the setCoupledBuckets method
859
     * This method is willingly generated in order to preserve the one-line inline validation within the setCoupledBuckets method
860
     * @param array $values
861
     * @return string A non-empty message if the values does not match the validation rules
862
     */
863
    public static function validateCoupledBucketsForArrayConstraintsFromSetCoupledBuckets(array $values = array())
864
    {
865
        $message = '';
866
        $invalidValues = [];
867
        foreach ($values as $doExpressCheckoutPaymentRequestDetailsTypeCoupledBucketsItem) {
868
            // validation for constraint: itemType
869
            if (!$doExpressCheckoutPaymentRequestDetailsTypeCoupledBucketsItem instanceof \PayPal\StructType\CoupledBucketsType) {
870
                $invalidValues[] = is_object($doExpressCheckoutPaymentRequestDetailsTypeCoupledBucketsItem) ? get_class($doExpressCheckoutPaymentRequestDetailsTypeCoupledBucketsItem) : sprintf('%s(%s)', gettype($doExpressCheckoutPaymentRequestDetailsTypeCoupledBucketsItem), var_export($doExpressCheckoutPaymentRequestDetailsTypeCoupledBucketsItem, true));
871
            }
872
        }
873
        if (!empty($invalidValues)) {
874
            $message = sprintf('The CoupledBuckets property can only contain items of type \PayPal\StructType\CoupledBucketsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
0 ignored issues
show
introduced by
The condition is_object($invalidValues) is always false.
Loading history...
introduced by
The condition is_array($invalidValues) is always true.
Loading history...
875
        }
876
        unset($invalidValues);
877
        return $message;
878
    }
879
    /**
880
     * Set CoupledBuckets value
881
     * @throws \InvalidArgumentException
882
     * @param \PayPal\StructType\CoupledBucketsType[] $coupledBuckets
883
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
884
     */
885
    public function setCoupledBuckets(array $coupledBuckets = array())
886
    {
887
        // validation for constraint: array
888
        if ('' !== ($coupledBucketsArrayErrorMessage = self::validateCoupledBucketsForArrayConstraintsFromSetCoupledBuckets($coupledBuckets))) {
889
            throw new \InvalidArgumentException($coupledBucketsArrayErrorMessage, __LINE__);
890
        }
891
        // validation for constraint: maxOccurs(5)
892
        if (is_array($coupledBuckets) && count($coupledBuckets) > 5) {
893
            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($coupledBuckets)), __LINE__);
894
        }
895
        $this->CoupledBuckets = $coupledBuckets;
896
        return $this;
897
    }
898
    /**
899
     * Add item to CoupledBuckets value
900
     * @throws \InvalidArgumentException
901
     * @param \PayPal\StructType\CoupledBucketsType $item
902
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
903
     */
904
    public function addToCoupledBuckets(\PayPal\StructType\CoupledBucketsType $item)
905
    {
906
        // validation for constraint: itemType
907
        if (!$item instanceof \PayPal\StructType\CoupledBucketsType) {
0 ignored issues
show
introduced by
$item is always a sub-type of PayPal\StructType\CoupledBucketsType.
Loading history...
908
            throw new \InvalidArgumentException(sprintf('The CoupledBuckets property can only contain items of type \PayPal\StructType\CoupledBucketsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
909
        }
910
        // validation for constraint: maxOccurs(5)
911
        if (is_array($this->CoupledBuckets) && count($this->CoupledBuckets) >= 5) {
912
            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->CoupledBuckets)), __LINE__);
913
        }
914
        $this->CoupledBuckets[] = $item;
915
        return $this;
916
    }
917
    /**
918
     * Get ClientID value
919
     * @return string|null
920
     */
921
    public function getClientID()
922
    {
923
        return $this->ClientID;
924
    }
925
    /**
926
     * Set ClientID value
927
     * @param string $clientID
928
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
929
     */
930
    public function setClientID($clientID = null)
931
    {
932
        // validation for constraint: string
933
        if (!is_null($clientID) && !is_string($clientID)) {
0 ignored issues
show
introduced by
The condition is_string($clientID) is always true.
Loading history...
934
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($clientID, true), gettype($clientID)), __LINE__);
935
        }
936
        $this->ClientID = $clientID;
937
        return $this;
938
    }
939
    /**
940
     * Get ProductLine value
941
     * @return string|null
942
     */
943
    public function getProductLine()
944
    {
945
        return $this->ProductLine;
946
    }
947
    /**
948
     * Set ProductLine value
949
     * @param string $productLine
950
     * @return \PayPal\StructType\DoExpressCheckoutPaymentRequestDetailsType
951
     */
952
    public function setProductLine($productLine = null)
953
    {
954
        // validation for constraint: string
955
        if (!is_null($productLine) && !is_string($productLine)) {
0 ignored issues
show
introduced by
The condition is_string($productLine) is always true.
Loading history...
956
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($productLine, true), gettype($productLine)), __LINE__);
957
        }
958
        $this->ProductLine = $productLine;
959
        return $this;
960
    }
961
}
962