|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PayPal\StructType; |
|
4
|
|
|
|
|
5
|
|
|
use \WsdlToPhp\PackageBase\AbstractStructBase; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* This class stands for IncentiveInfoType StructType |
|
9
|
|
|
* Meta information extracted from the WSDL |
|
10
|
|
|
* - documentation: Details of incentive application on individual bucket. |
|
11
|
|
|
* @subpackage Structs |
|
12
|
|
|
* @author WsdlToPhp <[email protected]> |
|
13
|
|
|
*/ |
|
14
|
|
|
class IncentiveInfoType extends AbstractStructBase |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* The IncentiveCode |
|
18
|
|
|
* Meta information extracted from the WSDL |
|
19
|
|
|
* - documentation: Incentive redemption code. |
|
20
|
|
|
* - maxOccurs: 1 |
|
21
|
|
|
* - minOccurs: 0 |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
public $IncentiveCode; |
|
25
|
|
|
/** |
|
26
|
|
|
* The ApplyIndication |
|
27
|
|
|
* Meta information extracted from the WSDL |
|
28
|
|
|
* - documentation: Defines which bucket or item that the incentive should be applied to. |
|
29
|
|
|
* - maxOccurs: unbounded |
|
30
|
|
|
* - minOccurs: 0 |
|
31
|
|
|
* @var \PayPal\StructType\IncentiveApplyIndicationType[] |
|
32
|
|
|
*/ |
|
33
|
|
|
public $ApplyIndication; |
|
34
|
|
|
/** |
|
35
|
|
|
* Constructor method for IncentiveInfoType |
|
36
|
|
|
* @uses IncentiveInfoType::setIncentiveCode() |
|
37
|
|
|
* @uses IncentiveInfoType::setApplyIndication() |
|
38
|
|
|
* @param string $incentiveCode |
|
39
|
|
|
* @param \PayPal\StructType\IncentiveApplyIndicationType[] $applyIndication |
|
40
|
|
|
*/ |
|
41
|
|
|
public function __construct($incentiveCode = null, array $applyIndication = array()) |
|
42
|
|
|
{ |
|
43
|
|
|
$this |
|
44
|
|
|
->setIncentiveCode($incentiveCode) |
|
45
|
|
|
->setApplyIndication($applyIndication); |
|
46
|
|
|
} |
|
47
|
|
|
/** |
|
48
|
|
|
* Get IncentiveCode value |
|
49
|
|
|
* @return string|null |
|
50
|
|
|
*/ |
|
51
|
|
|
public function getIncentiveCode() |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->IncentiveCode; |
|
54
|
|
|
} |
|
55
|
|
|
/** |
|
56
|
|
|
* Set IncentiveCode value |
|
57
|
|
|
* @param string $incentiveCode |
|
58
|
|
|
* @return \PayPal\StructType\IncentiveInfoType |
|
59
|
|
|
*/ |
|
60
|
|
|
public function setIncentiveCode($incentiveCode = null) |
|
61
|
|
|
{ |
|
62
|
|
|
// validation for constraint: string |
|
63
|
|
|
if (!is_null($incentiveCode) && !is_string($incentiveCode)) { |
|
|
|
|
|
|
64
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($incentiveCode, true), gettype($incentiveCode)), __LINE__); |
|
65
|
|
|
} |
|
66
|
|
|
$this->IncentiveCode = $incentiveCode; |
|
67
|
|
|
return $this; |
|
68
|
|
|
} |
|
69
|
|
|
/** |
|
70
|
|
|
* Get ApplyIndication value |
|
71
|
|
|
* @return \PayPal\StructType\IncentiveApplyIndicationType[]|null |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getApplyIndication() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->ApplyIndication; |
|
76
|
|
|
} |
|
77
|
|
|
/** |
|
78
|
|
|
* This method is responsible for validating the values passed to the setApplyIndication method |
|
79
|
|
|
* This method is willingly generated in order to preserve the one-line inline validation within the setApplyIndication method |
|
80
|
|
|
* @param array $values |
|
81
|
|
|
* @return string A non-empty message if the values does not match the validation rules |
|
82
|
|
|
*/ |
|
83
|
|
|
public static function validateApplyIndicationForArrayConstraintsFromSetApplyIndication(array $values = array()) |
|
84
|
|
|
{ |
|
85
|
|
|
$message = ''; |
|
86
|
|
|
$invalidValues = []; |
|
87
|
|
|
foreach ($values as $incentiveInfoTypeApplyIndicationItem) { |
|
88
|
|
|
// validation for constraint: itemType |
|
89
|
|
|
if (!$incentiveInfoTypeApplyIndicationItem instanceof \PayPal\StructType\IncentiveApplyIndicationType) { |
|
90
|
|
|
$invalidValues[] = is_object($incentiveInfoTypeApplyIndicationItem) ? get_class($incentiveInfoTypeApplyIndicationItem) : sprintf('%s(%s)', gettype($incentiveInfoTypeApplyIndicationItem), var_export($incentiveInfoTypeApplyIndicationItem, true)); |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
if (!empty($invalidValues)) { |
|
94
|
|
|
$message = sprintf('The ApplyIndication property can only contain items of type \PayPal\StructType\IncentiveApplyIndicationType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); |
|
|
|
|
|
|
95
|
|
|
} |
|
96
|
|
|
unset($invalidValues); |
|
97
|
|
|
return $message; |
|
98
|
|
|
} |
|
99
|
|
|
/** |
|
100
|
|
|
* Set ApplyIndication value |
|
101
|
|
|
* @throws \InvalidArgumentException |
|
102
|
|
|
* @param \PayPal\StructType\IncentiveApplyIndicationType[] $applyIndication |
|
103
|
|
|
* @return \PayPal\StructType\IncentiveInfoType |
|
104
|
|
|
*/ |
|
105
|
|
|
public function setApplyIndication(array $applyIndication = array()) |
|
106
|
|
|
{ |
|
107
|
|
|
// validation for constraint: array |
|
108
|
|
|
if ('' !== ($applyIndicationArrayErrorMessage = self::validateApplyIndicationForArrayConstraintsFromSetApplyIndication($applyIndication))) { |
|
109
|
|
|
throw new \InvalidArgumentException($applyIndicationArrayErrorMessage, __LINE__); |
|
110
|
|
|
} |
|
111
|
|
|
$this->ApplyIndication = $applyIndication; |
|
112
|
|
|
return $this; |
|
113
|
|
|
} |
|
114
|
|
|
/** |
|
115
|
|
|
* Add item to ApplyIndication value |
|
116
|
|
|
* @throws \InvalidArgumentException |
|
117
|
|
|
* @param \PayPal\StructType\IncentiveApplyIndicationType $item |
|
118
|
|
|
* @return \PayPal\StructType\IncentiveInfoType |
|
119
|
|
|
*/ |
|
120
|
|
|
public function addToApplyIndication(\PayPal\StructType\IncentiveApplyIndicationType $item) |
|
121
|
|
|
{ |
|
122
|
|
|
// validation for constraint: itemType |
|
123
|
|
|
if (!$item instanceof \PayPal\StructType\IncentiveApplyIndicationType) { |
|
|
|
|
|
|
124
|
|
|
throw new \InvalidArgumentException(sprintf('The ApplyIndication property can only contain items of type \PayPal\StructType\IncentiveApplyIndicationType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); |
|
125
|
|
|
} |
|
126
|
|
|
$this->ApplyIndication[] = $item; |
|
127
|
|
|
return $this; |
|
128
|
|
|
} |
|
129
|
|
|
} |
|
130
|
|
|
|