1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class PaymentProductFiltersHostedCheckout extends DataObject
15: {
16: /**
17: * @var PaymentProductFilter|null
18: */
19: public ?PaymentProductFilter $exclude = null;
20:
21: /**
22: * @var PaymentProductFilter|null
23: */
24: public ?PaymentProductFilter $restrictTo = null;
25:
26: /**
27: * @var bool|null
28: */
29: public ?bool $tokensOnly = null;
30:
31: /**
32: * @return object
33: */
34: public function toObject(): object
35: {
36: $object = parent::toObject();
37: if (!is_null($this->exclude)) {
38: $object->exclude = $this->exclude->toObject();
39: }
40: if (!is_null($this->restrictTo)) {
41: $object->restrictTo = $this->restrictTo->toObject();
42: }
43: if (!is_null($this->tokensOnly)) {
44: $object->tokensOnly = $this->tokensOnly;
45: }
46: return $object;
47: }
48:
49: /**
50: * @param object $object
51: *
52: * @return $this
53: * @throws UnexpectedValueException
54: */
55: public function fromObject(object $object): PaymentProductFiltersHostedCheckout
56: {
57: parent::fromObject($object);
58: if (property_exists($object, 'exclude')) {
59: if (!is_object($object->exclude)) {
60: throw new UnexpectedValueException('value \'' . print_r($object->exclude, true) . '\' is not an object');
61: }
62: $value = new PaymentProductFilter();
63: $this->exclude = $value->fromObject($object->exclude);
64: }
65: if (property_exists($object, 'restrictTo')) {
66: if (!is_object($object->restrictTo)) {
67: throw new UnexpectedValueException('value \'' . print_r($object->restrictTo, true) . '\' is not an object');
68: }
69: $value = new PaymentProductFilter();
70: $this->restrictTo = $value->fromObject($object->restrictTo);
71: }
72: if (property_exists($object, 'tokensOnly')) {
73: $this->tokensOnly = $object->tokensOnly;
74: }
75: return $this;
76: }
77: }
78: