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 CreateMandateBase extends DataObject
15: {
16: /**
17: * @var string|null
18: */
19: public ?string $alias = null;
20:
21: /**
22: * @var MandateCustomer|null
23: */
24: public ?MandateCustomer $customer = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $customerReference = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $language = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $recurrenceType = null;
40:
41: /**
42: * @var string|null
43: */
44: public ?string $signatureType = null;
45:
46: /**
47: * @var string|null
48: */
49: public ?string $uniqueMandateReference = null;
50:
51: /**
52: * @return object
53: */
54: public function toObject(): object
55: {
56: $object = parent::toObject();
57: if (!is_null($this->alias)) {
58: $object->alias = $this->alias;
59: }
60: if (!is_null($this->customer)) {
61: $object->customer = $this->customer->toObject();
62: }
63: if (!is_null($this->customerReference)) {
64: $object->customerReference = $this->customerReference;
65: }
66: if (!is_null($this->language)) {
67: $object->language = $this->language;
68: }
69: if (!is_null($this->recurrenceType)) {
70: $object->recurrenceType = $this->recurrenceType;
71: }
72: if (!is_null($this->signatureType)) {
73: $object->signatureType = $this->signatureType;
74: }
75: if (!is_null($this->uniqueMandateReference)) {
76: $object->uniqueMandateReference = $this->uniqueMandateReference;
77: }
78: return $object;
79: }
80:
81: /**
82: * @param object $object
83: *
84: * @return $this
85: * @throws UnexpectedValueException
86: */
87: public function fromObject(object $object): CreateMandateBase
88: {
89: parent::fromObject($object);
90: if (property_exists($object, 'alias')) {
91: $this->alias = $object->alias;
92: }
93: if (property_exists($object, 'customer')) {
94: if (!is_object($object->customer)) {
95: throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object');
96: }
97: $value = new MandateCustomer();
98: $this->customer = $value->fromObject($object->customer);
99: }
100: if (property_exists($object, 'customerReference')) {
101: $this->customerReference = $object->customerReference;
102: }
103: if (property_exists($object, 'language')) {
104: $this->language = $object->language;
105: }
106: if (property_exists($object, 'recurrenceType')) {
107: $this->recurrenceType = $object->recurrenceType;
108: }
109: if (property_exists($object, 'signatureType')) {
110: $this->signatureType = $object->signatureType;
111: }
112: if (property_exists($object, 'uniqueMandateReference')) {
113: $this->uniqueMandateReference = $object->uniqueMandateReference;
114: }
115: return $this;
116: }
117: }
118: