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 PaymentProductFieldValidators extends DataObject
15: {
16: /**
17: * @var BoletoBancarioRequirednessValidator|null
18: */
19: public ?BoletoBancarioRequirednessValidator $boletoBancarioRequiredness = null;
20:
21: /**
22: * @var EmptyValidator|null
23: */
24: public ?EmptyValidator $emailAddress = null;
25:
26: /**
27: * @var EmptyValidator|null
28: */
29: public ?EmptyValidator $expirationDate = null;
30:
31: /**
32: * @var FixedListValidator|null
33: */
34: public ?FixedListValidator $fixedList = null;
35:
36: /**
37: * @var EmptyValidator|null
38: */
39: public ?EmptyValidator $iban = null;
40:
41: /**
42: * @var LengthValidator|null
43: */
44: public ?LengthValidator $length = null;
45:
46: /**
47: * @var EmptyValidator|null
48: */
49: public ?EmptyValidator $luhn = null;
50:
51: /**
52: * @var RangeValidator|null
53: */
54: public ?RangeValidator $range = null;
55:
56: /**
57: * @var RegularExpressionValidator|null
58: */
59: public ?RegularExpressionValidator $regularExpression = null;
60:
61: /**
62: * @var EmptyValidator|null
63: */
64: public ?EmptyValidator $residentIdNumber = null;
65:
66: /**
67: * @var EmptyValidator|null
68: */
69: public ?EmptyValidator $termsAndConditions = null;
70:
71: /**
72: * @return object
73: */
74: public function toObject(): object
75: {
76: $object = parent::toObject();
77: if (!is_null($this->boletoBancarioRequiredness)) {
78: $object->boletoBancarioRequiredness = $this->boletoBancarioRequiredness->toObject();
79: }
80: if (!is_null($this->emailAddress)) {
81: $object->emailAddress = $this->emailAddress->toObject();
82: }
83: if (!is_null($this->expirationDate)) {
84: $object->expirationDate = $this->expirationDate->toObject();
85: }
86: if (!is_null($this->fixedList)) {
87: $object->fixedList = $this->fixedList->toObject();
88: }
89: if (!is_null($this->iban)) {
90: $object->iban = $this->iban->toObject();
91: }
92: if (!is_null($this->length)) {
93: $object->length = $this->length->toObject();
94: }
95: if (!is_null($this->luhn)) {
96: $object->luhn = $this->luhn->toObject();
97: }
98: if (!is_null($this->range)) {
99: $object->range = $this->range->toObject();
100: }
101: if (!is_null($this->regularExpression)) {
102: $object->regularExpression = $this->regularExpression->toObject();
103: }
104: if (!is_null($this->residentIdNumber)) {
105: $object->residentIdNumber = $this->residentIdNumber->toObject();
106: }
107: if (!is_null($this->termsAndConditions)) {
108: $object->termsAndConditions = $this->termsAndConditions->toObject();
109: }
110: return $object;
111: }
112:
113: /**
114: * @param object $object
115: *
116: * @return $this
117: * @throws UnexpectedValueException
118: */
119: public function fromObject(object $object): PaymentProductFieldValidators
120: {
121: parent::fromObject($object);
122: if (property_exists($object, 'boletoBancarioRequiredness')) {
123: if (!is_object($object->boletoBancarioRequiredness)) {
124: throw new UnexpectedValueException('value \'' . print_r($object->boletoBancarioRequiredness, true) . '\' is not an object');
125: }
126: $value = new BoletoBancarioRequirednessValidator();
127: $this->boletoBancarioRequiredness = $value->fromObject($object->boletoBancarioRequiredness);
128: }
129: if (property_exists($object, 'emailAddress')) {
130: if (!is_object($object->emailAddress)) {
131: throw new UnexpectedValueException('value \'' . print_r($object->emailAddress, true) . '\' is not an object');
132: }
133: $value = new EmptyValidator();
134: $this->emailAddress = $value->fromObject($object->emailAddress);
135: }
136: if (property_exists($object, 'expirationDate')) {
137: if (!is_object($object->expirationDate)) {
138: throw new UnexpectedValueException('value \'' . print_r($object->expirationDate, true) . '\' is not an object');
139: }
140: $value = new EmptyValidator();
141: $this->expirationDate = $value->fromObject($object->expirationDate);
142: }
143: if (property_exists($object, 'fixedList')) {
144: if (!is_object($object->fixedList)) {
145: throw new UnexpectedValueException('value \'' . print_r($object->fixedList, true) . '\' is not an object');
146: }
147: $value = new FixedListValidator();
148: $this->fixedList = $value->fromObject($object->fixedList);
149: }
150: if (property_exists($object, 'iban')) {
151: if (!is_object($object->iban)) {
152: throw new UnexpectedValueException('value \'' . print_r($object->iban, true) . '\' is not an object');
153: }
154: $value = new EmptyValidator();
155: $this->iban = $value->fromObject($object->iban);
156: }
157: if (property_exists($object, 'length')) {
158: if (!is_object($object->length)) {
159: throw new UnexpectedValueException('value \'' . print_r($object->length, true) . '\' is not an object');
160: }
161: $value = new LengthValidator();
162: $this->length = $value->fromObject($object->length);
163: }
164: if (property_exists($object, 'luhn')) {
165: if (!is_object($object->luhn)) {
166: throw new UnexpectedValueException('value \'' . print_r($object->luhn, true) . '\' is not an object');
167: }
168: $value = new EmptyValidator();
169: $this->luhn = $value->fromObject($object->luhn);
170: }
171: if (property_exists($object, 'range')) {
172: if (!is_object($object->range)) {
173: throw new UnexpectedValueException('value \'' . print_r($object->range, true) . '\' is not an object');
174: }
175: $value = new RangeValidator();
176: $this->range = $value->fromObject($object->range);
177: }
178: if (property_exists($object, 'regularExpression')) {
179: if (!is_object($object->regularExpression)) {
180: throw new UnexpectedValueException('value \'' . print_r($object->regularExpression, true) . '\' is not an object');
181: }
182: $value = new RegularExpressionValidator();
183: $this->regularExpression = $value->fromObject($object->regularExpression);
184: }
185: if (property_exists($object, 'residentIdNumber')) {
186: if (!is_object($object->residentIdNumber)) {
187: throw new UnexpectedValueException('value \'' . print_r($object->residentIdNumber, true) . '\' is not an object');
188: }
189: $value = new EmptyValidator();
190: $this->residentIdNumber = $value->fromObject($object->residentIdNumber);
191: }
192: if (property_exists($object, 'termsAndConditions')) {
193: if (!is_object($object->termsAndConditions)) {
194: throw new UnexpectedValueException('value \'' . print_r($object->termsAndConditions, true) . '\' is not an object');
195: }
196: $value = new EmptyValidator();
197: $this->termsAndConditions = $value->fromObject($object->termsAndConditions);
198: }
199: return $this;
200: }
201: }
202: