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 PaymentProductField extends DataObject
15: {
16: /**
17: * @var PaymentProductFieldDataRestrictions|null
18: */
19: public ?PaymentProductFieldDataRestrictions $dataRestrictions = null;
20:
21: /**
22: * @var PaymentProductFieldDisplayHints|null
23: */
24: public ?PaymentProductFieldDisplayHints $displayHints = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $id = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $type = null;
35:
36: /**
37: * @var bool|null
38: */
39: public ?bool $usedForLookup = null;
40:
41: /**
42: * @return object
43: */
44: public function toObject(): object
45: {
46: $object = parent::toObject();
47: if (!is_null($this->dataRestrictions)) {
48: $object->dataRestrictions = $this->dataRestrictions->toObject();
49: }
50: if (!is_null($this->displayHints)) {
51: $object->displayHints = $this->displayHints->toObject();
52: }
53: if (!is_null($this->id)) {
54: $object->id = $this->id;
55: }
56: if (!is_null($this->type)) {
57: $object->type = $this->type;
58: }
59: if (!is_null($this->usedForLookup)) {
60: $object->usedForLookup = $this->usedForLookup;
61: }
62: return $object;
63: }
64:
65: /**
66: * @param object $object
67: *
68: * @return $this
69: * @throws UnexpectedValueException
70: */
71: public function fromObject(object $object): PaymentProductField
72: {
73: parent::fromObject($object);
74: if (property_exists($object, 'dataRestrictions')) {
75: if (!is_object($object->dataRestrictions)) {
76: throw new UnexpectedValueException('value \'' . print_r($object->dataRestrictions, true) . '\' is not an object');
77: }
78: $value = new PaymentProductFieldDataRestrictions();
79: $this->dataRestrictions = $value->fromObject($object->dataRestrictions);
80: }
81: if (property_exists($object, 'displayHints')) {
82: if (!is_object($object->displayHints)) {
83: throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object');
84: }
85: $value = new PaymentProductFieldDisplayHints();
86: $this->displayHints = $value->fromObject($object->displayHints);
87: }
88: if (property_exists($object, 'id')) {
89: $this->id = $object->id;
90: }
91: if (property_exists($object, 'type')) {
92: $this->type = $object->type;
93: }
94: if (property_exists($object, 'usedForLookup')) {
95: $this->usedForLookup = $object->usedForLookup;
96: }
97: return $this;
98: }
99: }
100: