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