PaymentTransactionType::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 16
c 1
b 0
f 0
nc 1
nop 15
dl 0
loc 18
rs 9.7333

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 PaymentTransactionType StructType
9
 * Meta information extracted from the WSDL
10
 * - documentation: PaymentTransactionType Information about a PayPal payment from the seller side
11
 * @subpackage Structs
12
 * @author WsdlToPhp <[email protected]>
13
 */
14
class PaymentTransactionType extends AbstractStructBase
15
{
16
    /**
17
     * The ReceiverInfo
18
     * Meta information extracted from the WSDL
19
     * - documentation: Information about the recipient of the payment
20
     * @var \PayPal\StructType\ReceiverInfoType
21
     */
22
    public $ReceiverInfo;
23
    /**
24
     * The PayerInfo
25
     * Meta information extracted from the WSDL
26
     * - documentation: Information about the payer
27
     * @var \PayPal\StructType\PayerInfoType
28
     */
29
    public $PayerInfo;
30
    /**
31
     * The TPLReferenceID
32
     * Meta information extracted from the WSDL
33
     * - documentation: This field is for holding ReferenceId for shippment sent from Merchant to the 3rd Party
34
     * - maxOccurs: 1
35
     * - minOccurs: 0
36
     * @var string
37
     */
38
    public $TPLReferenceID;
39
    /**
40
     * The PaymentInfo
41
     * Meta information extracted from the WSDL
42
     * - documentation: Information about the transaction
43
     * @var \PayPal\StructType\PaymentInfoType
44
     */
45
    public $PaymentInfo;
46
    /**
47
     * The PaymentItemInfo
48
     * Meta information extracted from the WSDL
49
     * - documentation: Information about an individual item in the transaction
50
     * - minOccurs: 0
51
     * @var \PayPal\StructType\PaymentItemInfoType
52
     */
53
    public $PaymentItemInfo;
54
    /**
55
     * The OfferCouponInfo
56
     * Meta information extracted from the WSDL
57
     * - documentation: Information about an individual Offer and Coupon information in the transaction
58
     * - minOccurs: 0
59
     * @var \PayPal\StructType\OfferCouponInfoType
60
     */
61
    public $OfferCouponInfo;
62
    /**
63
     * The SecondaryAddress
64
     * Meta information extracted from the WSDL
65
     * - documentation: Information about Secondary Address
66
     * - minOccurs: 0
67
     * @var \PayPal\StructType\AddressType
68
     */
69
    public $SecondaryAddress;
70
    /**
71
     * The UserSelectedOptions
72
     * Meta information extracted from the WSDL
73
     * - documentation: Information about the user selected options.
74
     * - maxOccurs: 1
75
     * - minOccurs: 0
76
     * @var \PayPal\StructType\UserSelectedOptionType
77
     */
78
    public $UserSelectedOptions;
79
    /**
80
     * The GiftMessage
81
     * Meta information extracted from the WSDL
82
     * - documentation: Information about the Gift message.
83
     * - maxOccurs: 1
84
     * - minOccurs: 0
85
     * @var string
86
     */
87
    public $GiftMessage;
88
    /**
89
     * The GiftReceipt
90
     * Meta information extracted from the WSDL
91
     * - documentation: Information about the Gift receipt.
92
     * - maxOccurs: 1
93
     * - minOccurs: 0
94
     * @var string
95
     */
96
    public $GiftReceipt;
97
    /**
98
     * The GiftWrapName
99
     * Meta information extracted from the WSDL
100
     * - documentation: Information about the Gift Wrap name.
101
     * - maxOccurs: 1
102
     * - minOccurs: 0
103
     * @var string
104
     */
105
    public $GiftWrapName;
106
    /**
107
     * The GiftWrapAmount
108
     * Meta information extracted from the WSDL
109
     * - documentation: Information about the Gift Wrap amount.
110
     * - maxOccurs: 1
111
     * - minOccurs: 0
112
     * @var \PayPal\StructType\BasicAmountType
113
     */
114
    public $GiftWrapAmount;
115
    /**
116
     * The BuyerEmailOptIn
117
     * Meta information extracted from the WSDL
118
     * - documentation: Information about the Buyer email.
119
     * - maxOccurs: 1
120
     * - minOccurs: 0
121
     * @var string
122
     */
123
    public $BuyerEmailOptIn;
124
    /**
125
     * The SurveyQuestion
126
     * Meta information extracted from the WSDL
127
     * - documentation: Information about the survey question.
128
     * - maxOccurs: 1
129
     * - minOccurs: 0
130
     * @var string
131
     */
132
    public $SurveyQuestion;
133
    /**
134
     * The SurveyChoiceSelected
135
     * Meta information extracted from the WSDL
136
     * - documentation: Information about the survey choice selected by the user.
137
     * - maxOccurs: unbounded
138
     * - minOccurs: 0
139
     * @var string[]
140
     */
141
    public $SurveyChoiceSelected;
142
    /**
143
     * Constructor method for PaymentTransactionType
144
     * @uses PaymentTransactionType::setReceiverInfo()
145
     * @uses PaymentTransactionType::setPayerInfo()
146
     * @uses PaymentTransactionType::setTPLReferenceID()
147
     * @uses PaymentTransactionType::setPaymentInfo()
148
     * @uses PaymentTransactionType::setPaymentItemInfo()
149
     * @uses PaymentTransactionType::setOfferCouponInfo()
150
     * @uses PaymentTransactionType::setSecondaryAddress()
151
     * @uses PaymentTransactionType::setUserSelectedOptions()
152
     * @uses PaymentTransactionType::setGiftMessage()
153
     * @uses PaymentTransactionType::setGiftReceipt()
154
     * @uses PaymentTransactionType::setGiftWrapName()
155
     * @uses PaymentTransactionType::setGiftWrapAmount()
156
     * @uses PaymentTransactionType::setBuyerEmailOptIn()
157
     * @uses PaymentTransactionType::setSurveyQuestion()
158
     * @uses PaymentTransactionType::setSurveyChoiceSelected()
159
     * @param \PayPal\StructType\ReceiverInfoType $receiverInfo
160
     * @param \PayPal\StructType\PayerInfoType $payerInfo
161
     * @param string $tPLReferenceID
162
     * @param \PayPal\StructType\PaymentInfoType $paymentInfo
163
     * @param \PayPal\StructType\PaymentItemInfoType $paymentItemInfo
164
     * @param \PayPal\StructType\OfferCouponInfoType $offerCouponInfo
165
     * @param \PayPal\StructType\AddressType $secondaryAddress
166
     * @param \PayPal\StructType\UserSelectedOptionType $userSelectedOptions
167
     * @param string $giftMessage
168
     * @param string $giftReceipt
169
     * @param string $giftWrapName
170
     * @param \PayPal\StructType\BasicAmountType $giftWrapAmount
171
     * @param string $buyerEmailOptIn
172
     * @param string $surveyQuestion
173
     * @param string[] $surveyChoiceSelected
174
     */
175
    public function __construct(\PayPal\StructType\ReceiverInfoType $receiverInfo = null, \PayPal\StructType\PayerInfoType $payerInfo = null, $tPLReferenceID = null, \PayPal\StructType\PaymentInfoType $paymentInfo = null, \PayPal\StructType\PaymentItemInfoType $paymentItemInfo = null, \PayPal\StructType\OfferCouponInfoType $offerCouponInfo = null, \PayPal\StructType\AddressType $secondaryAddress = null, \PayPal\StructType\UserSelectedOptionType $userSelectedOptions = null, $giftMessage = null, $giftReceipt = null, $giftWrapName = null, \PayPal\StructType\BasicAmountType $giftWrapAmount = null, $buyerEmailOptIn = null, $surveyQuestion = null, array $surveyChoiceSelected = array())
176
    {
177
        $this
178
            ->setReceiverInfo($receiverInfo)
179
            ->setPayerInfo($payerInfo)
180
            ->setTPLReferenceID($tPLReferenceID)
181
            ->setPaymentInfo($paymentInfo)
182
            ->setPaymentItemInfo($paymentItemInfo)
183
            ->setOfferCouponInfo($offerCouponInfo)
184
            ->setSecondaryAddress($secondaryAddress)
185
            ->setUserSelectedOptions($userSelectedOptions)
186
            ->setGiftMessage($giftMessage)
187
            ->setGiftReceipt($giftReceipt)
188
            ->setGiftWrapName($giftWrapName)
189
            ->setGiftWrapAmount($giftWrapAmount)
190
            ->setBuyerEmailOptIn($buyerEmailOptIn)
191
            ->setSurveyQuestion($surveyQuestion)
192
            ->setSurveyChoiceSelected($surveyChoiceSelected);
193
    }
194
    /**
195
     * Get ReceiverInfo value
196
     * @return \PayPal\StructType\ReceiverInfoType|null
197
     */
198
    public function getReceiverInfo()
199
    {
200
        return $this->ReceiverInfo;
201
    }
202
    /**
203
     * Set ReceiverInfo value
204
     * @param \PayPal\StructType\ReceiverInfoType $receiverInfo
205
     * @return \PayPal\StructType\PaymentTransactionType
206
     */
207
    public function setReceiverInfo(\PayPal\StructType\ReceiverInfoType $receiverInfo = null)
208
    {
209
        $this->ReceiverInfo = $receiverInfo;
210
        return $this;
211
    }
212
    /**
213
     * Get PayerInfo value
214
     * @return \PayPal\StructType\PayerInfoType|null
215
     */
216
    public function getPayerInfo()
217
    {
218
        return $this->PayerInfo;
219
    }
220
    /**
221
     * Set PayerInfo value
222
     * @param \PayPal\StructType\PayerInfoType $payerInfo
223
     * @return \PayPal\StructType\PaymentTransactionType
224
     */
225
    public function setPayerInfo(\PayPal\StructType\PayerInfoType $payerInfo = null)
226
    {
227
        $this->PayerInfo = $payerInfo;
228
        return $this;
229
    }
230
    /**
231
     * Get TPLReferenceID value
232
     * @return string|null
233
     */
234
    public function getTPLReferenceID()
235
    {
236
        return $this->TPLReferenceID;
237
    }
238
    /**
239
     * Set TPLReferenceID value
240
     * @param string $tPLReferenceID
241
     * @return \PayPal\StructType\PaymentTransactionType
242
     */
243
    public function setTPLReferenceID($tPLReferenceID = null)
244
    {
245
        // validation for constraint: string
246
        if (!is_null($tPLReferenceID) && !is_string($tPLReferenceID)) {
0 ignored issues
show
introduced by
The condition is_string($tPLReferenceID) is always true.
Loading history...
247
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($tPLReferenceID, true), gettype($tPLReferenceID)), __LINE__);
248
        }
249
        $this->TPLReferenceID = $tPLReferenceID;
250
        return $this;
251
    }
252
    /**
253
     * Get PaymentInfo value
254
     * @return \PayPal\StructType\PaymentInfoType|null
255
     */
256
    public function getPaymentInfo()
257
    {
258
        return $this->PaymentInfo;
259
    }
260
    /**
261
     * Set PaymentInfo value
262
     * @param \PayPal\StructType\PaymentInfoType $paymentInfo
263
     * @return \PayPal\StructType\PaymentTransactionType
264
     */
265
    public function setPaymentInfo(\PayPal\StructType\PaymentInfoType $paymentInfo = null)
266
    {
267
        $this->PaymentInfo = $paymentInfo;
268
        return $this;
269
    }
270
    /**
271
     * Get PaymentItemInfo value
272
     * @return \PayPal\StructType\PaymentItemInfoType|null
273
     */
274
    public function getPaymentItemInfo()
275
    {
276
        return $this->PaymentItemInfo;
277
    }
278
    /**
279
     * Set PaymentItemInfo value
280
     * @param \PayPal\StructType\PaymentItemInfoType $paymentItemInfo
281
     * @return \PayPal\StructType\PaymentTransactionType
282
     */
283
    public function setPaymentItemInfo(\PayPal\StructType\PaymentItemInfoType $paymentItemInfo = null)
284
    {
285
        $this->PaymentItemInfo = $paymentItemInfo;
286
        return $this;
287
    }
288
    /**
289
     * Get OfferCouponInfo value
290
     * @return \PayPal\StructType\OfferCouponInfoType|null
291
     */
292
    public function getOfferCouponInfo()
293
    {
294
        return $this->OfferCouponInfo;
295
    }
296
    /**
297
     * Set OfferCouponInfo value
298
     * @param \PayPal\StructType\OfferCouponInfoType $offerCouponInfo
299
     * @return \PayPal\StructType\PaymentTransactionType
300
     */
301
    public function setOfferCouponInfo(\PayPal\StructType\OfferCouponInfoType $offerCouponInfo = null)
302
    {
303
        $this->OfferCouponInfo = $offerCouponInfo;
304
        return $this;
305
    }
306
    /**
307
     * Get SecondaryAddress value
308
     * @return \PayPal\StructType\AddressType|null
309
     */
310
    public function getSecondaryAddress()
311
    {
312
        return $this->SecondaryAddress;
313
    }
314
    /**
315
     * Set SecondaryAddress value
316
     * @param \PayPal\StructType\AddressType $secondaryAddress
317
     * @return \PayPal\StructType\PaymentTransactionType
318
     */
319
    public function setSecondaryAddress(\PayPal\StructType\AddressType $secondaryAddress = null)
320
    {
321
        $this->SecondaryAddress = $secondaryAddress;
322
        return $this;
323
    }
324
    /**
325
     * Get UserSelectedOptions value
326
     * @return \PayPal\StructType\UserSelectedOptionType|null
327
     */
328
    public function getUserSelectedOptions()
329
    {
330
        return $this->UserSelectedOptions;
331
    }
332
    /**
333
     * Set UserSelectedOptions value
334
     * @param \PayPal\StructType\UserSelectedOptionType $userSelectedOptions
335
     * @return \PayPal\StructType\PaymentTransactionType
336
     */
337
    public function setUserSelectedOptions(\PayPal\StructType\UserSelectedOptionType $userSelectedOptions = null)
338
    {
339
        $this->UserSelectedOptions = $userSelectedOptions;
340
        return $this;
341
    }
342
    /**
343
     * Get GiftMessage value
344
     * @return string|null
345
     */
346
    public function getGiftMessage()
347
    {
348
        return $this->GiftMessage;
349
    }
350
    /**
351
     * Set GiftMessage value
352
     * @param string $giftMessage
353
     * @return \PayPal\StructType\PaymentTransactionType
354
     */
355
    public function setGiftMessage($giftMessage = null)
356
    {
357
        // validation for constraint: string
358
        if (!is_null($giftMessage) && !is_string($giftMessage)) {
0 ignored issues
show
introduced by
The condition is_string($giftMessage) is always true.
Loading history...
359
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftMessage, true), gettype($giftMessage)), __LINE__);
360
        }
361
        $this->GiftMessage = $giftMessage;
362
        return $this;
363
    }
364
    /**
365
     * Get GiftReceipt value
366
     * @return string|null
367
     */
368
    public function getGiftReceipt()
369
    {
370
        return $this->GiftReceipt;
371
    }
372
    /**
373
     * Set GiftReceipt value
374
     * @param string $giftReceipt
375
     * @return \PayPal\StructType\PaymentTransactionType
376
     */
377
    public function setGiftReceipt($giftReceipt = null)
378
    {
379
        // validation for constraint: string
380
        if (!is_null($giftReceipt) && !is_string($giftReceipt)) {
0 ignored issues
show
introduced by
The condition is_string($giftReceipt) is always true.
Loading history...
381
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftReceipt, true), gettype($giftReceipt)), __LINE__);
382
        }
383
        $this->GiftReceipt = $giftReceipt;
384
        return $this;
385
    }
386
    /**
387
     * Get GiftWrapName value
388
     * @return string|null
389
     */
390
    public function getGiftWrapName()
391
    {
392
        return $this->GiftWrapName;
393
    }
394
    /**
395
     * Set GiftWrapName value
396
     * @param string $giftWrapName
397
     * @return \PayPal\StructType\PaymentTransactionType
398
     */
399
    public function setGiftWrapName($giftWrapName = null)
400
    {
401
        // validation for constraint: string
402
        if (!is_null($giftWrapName) && !is_string($giftWrapName)) {
0 ignored issues
show
introduced by
The condition is_string($giftWrapName) is always true.
Loading history...
403
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($giftWrapName, true), gettype($giftWrapName)), __LINE__);
404
        }
405
        $this->GiftWrapName = $giftWrapName;
406
        return $this;
407
    }
408
    /**
409
     * Get GiftWrapAmount value
410
     * @return \PayPal\StructType\BasicAmountType|null
411
     */
412
    public function getGiftWrapAmount()
413
    {
414
        return $this->GiftWrapAmount;
415
    }
416
    /**
417
     * Set GiftWrapAmount value
418
     * @param \PayPal\StructType\BasicAmountType $giftWrapAmount
419
     * @return \PayPal\StructType\PaymentTransactionType
420
     */
421
    public function setGiftWrapAmount(\PayPal\StructType\BasicAmountType $giftWrapAmount = null)
422
    {
423
        $this->GiftWrapAmount = $giftWrapAmount;
424
        return $this;
425
    }
426
    /**
427
     * Get BuyerEmailOptIn value
428
     * @return string|null
429
     */
430
    public function getBuyerEmailOptIn()
431
    {
432
        return $this->BuyerEmailOptIn;
433
    }
434
    /**
435
     * Set BuyerEmailOptIn value
436
     * @param string $buyerEmailOptIn
437
     * @return \PayPal\StructType\PaymentTransactionType
438
     */
439
    public function setBuyerEmailOptIn($buyerEmailOptIn = null)
440
    {
441
        // validation for constraint: string
442
        if (!is_null($buyerEmailOptIn) && !is_string($buyerEmailOptIn)) {
0 ignored issues
show
introduced by
The condition is_string($buyerEmailOptIn) is always true.
Loading history...
443
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buyerEmailOptIn, true), gettype($buyerEmailOptIn)), __LINE__);
444
        }
445
        $this->BuyerEmailOptIn = $buyerEmailOptIn;
446
        return $this;
447
    }
448
    /**
449
     * Get SurveyQuestion value
450
     * @return string|null
451
     */
452
    public function getSurveyQuestion()
453
    {
454
        return $this->SurveyQuestion;
455
    }
456
    /**
457
     * Set SurveyQuestion value
458
     * @param string $surveyQuestion
459
     * @return \PayPal\StructType\PaymentTransactionType
460
     */
461
    public function setSurveyQuestion($surveyQuestion = null)
462
    {
463
        // validation for constraint: string
464
        if (!is_null($surveyQuestion) && !is_string($surveyQuestion)) {
0 ignored issues
show
introduced by
The condition is_string($surveyQuestion) is always true.
Loading history...
465
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($surveyQuestion, true), gettype($surveyQuestion)), __LINE__);
466
        }
467
        $this->SurveyQuestion = $surveyQuestion;
468
        return $this;
469
    }
470
    /**
471
     * Get SurveyChoiceSelected value
472
     * @return string[]|null
473
     */
474
    public function getSurveyChoiceSelected()
475
    {
476
        return $this->SurveyChoiceSelected;
477
    }
478
    /**
479
     * This method is responsible for validating the values passed to the setSurveyChoiceSelected method
480
     * This method is willingly generated in order to preserve the one-line inline validation within the setSurveyChoiceSelected method
481
     * @param array $values
482
     * @return string A non-empty message if the values does not match the validation rules
483
     */
484
    public static function validateSurveyChoiceSelectedForArrayConstraintsFromSetSurveyChoiceSelected(array $values = array())
485
    {
486
        $message = '';
487
        $invalidValues = [];
488
        foreach ($values as $paymentTransactionTypeSurveyChoiceSelectedItem) {
489
            // validation for constraint: itemType
490
            if (!is_string($paymentTransactionTypeSurveyChoiceSelectedItem)) {
491
                $invalidValues[] = is_object($paymentTransactionTypeSurveyChoiceSelectedItem) ? get_class($paymentTransactionTypeSurveyChoiceSelectedItem) : sprintf('%s(%s)', gettype($paymentTransactionTypeSurveyChoiceSelectedItem), var_export($paymentTransactionTypeSurveyChoiceSelectedItem, true));
492
            }
493
        }
494
        if (!empty($invalidValues)) {
495
            $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_object($invalidValues) is always false.
Loading history...
introduced by
The condition is_array($invalidValues) is always true.
Loading history...
496
        }
497
        unset($invalidValues);
498
        return $message;
499
    }
500
    /**
501
     * Set SurveyChoiceSelected value
502
     * @throws \InvalidArgumentException
503
     * @param string[] $surveyChoiceSelected
504
     * @return \PayPal\StructType\PaymentTransactionType
505
     */
506
    public function setSurveyChoiceSelected(array $surveyChoiceSelected = array())
507
    {
508
        // validation for constraint: array
509
        if ('' !== ($surveyChoiceSelectedArrayErrorMessage = self::validateSurveyChoiceSelectedForArrayConstraintsFromSetSurveyChoiceSelected($surveyChoiceSelected))) {
510
            throw new \InvalidArgumentException($surveyChoiceSelectedArrayErrorMessage, __LINE__);
511
        }
512
        $this->SurveyChoiceSelected = $surveyChoiceSelected;
513
        return $this;
514
    }
515
    /**
516
     * Add item to SurveyChoiceSelected value
517
     * @throws \InvalidArgumentException
518
     * @param string $item
519
     * @return \PayPal\StructType\PaymentTransactionType
520
     */
521
    public function addToSurveyChoiceSelected($item)
522
    {
523
        // validation for constraint: itemType
524
        if (!is_string($item)) {
0 ignored issues
show
introduced by
The condition is_string($item) is always true.
Loading history...
525
            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__);
526
        }
527
        $this->SurveyChoiceSelected[] = $item;
528
        return $this;
529
    }
530
}
531