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 DisputeOutput extends DataObject
15: {
16: /**
17: * @var AmountOfMoney|null
18: */
19: public ?AmountOfMoney $amountOfMoney = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $contactPerson = null;
25:
26: /**
27: * @var DisputeCreationDetail|null
28: */
29: public ?DisputeCreationDetail $creationDetails = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $emailAddress = null;
35:
36: /**
37: * @var HostedFile[]|null
38: */
39: public ?array $files = null;
40:
41: /**
42: * @var DisputeReference|null
43: */
44: public ?DisputeReference $reference = null;
45:
46: /**
47: * @var string|null
48: */
49: public ?string $replyTo = null;
50:
51: /**
52: * @var string|null
53: */
54: public ?string $requestMessage = null;
55:
56: /**
57: * @var string|null
58: */
59: public ?string $responseMessage = null;
60:
61: /**
62: * @return object
63: */
64: public function toObject(): object
65: {
66: $object = parent::toObject();
67: if (!is_null($this->amountOfMoney)) {
68: $object->amountOfMoney = $this->amountOfMoney->toObject();
69: }
70: if (!is_null($this->contactPerson)) {
71: $object->contactPerson = $this->contactPerson;
72: }
73: if (!is_null($this->creationDetails)) {
74: $object->creationDetails = $this->creationDetails->toObject();
75: }
76: if (!is_null($this->emailAddress)) {
77: $object->emailAddress = $this->emailAddress;
78: }
79: if (!is_null($this->files)) {
80: $object->files = [];
81: foreach ($this->files as $element) {
82: if (!is_null($element)) {
83: $object->files[] = $element->toObject();
84: }
85: }
86: }
87: if (!is_null($this->reference)) {
88: $object->reference = $this->reference->toObject();
89: }
90: if (!is_null($this->replyTo)) {
91: $object->replyTo = $this->replyTo;
92: }
93: if (!is_null($this->requestMessage)) {
94: $object->requestMessage = $this->requestMessage;
95: }
96: if (!is_null($this->responseMessage)) {
97: $object->responseMessage = $this->responseMessage;
98: }
99: return $object;
100: }
101:
102: /**
103: * @param object $object
104: *
105: * @return $this
106: * @throws UnexpectedValueException
107: */
108: public function fromObject(object $object): DisputeOutput
109: {
110: parent::fromObject($object);
111: if (property_exists($object, 'amountOfMoney')) {
112: if (!is_object($object->amountOfMoney)) {
113: throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object');
114: }
115: $value = new AmountOfMoney();
116: $this->amountOfMoney = $value->fromObject($object->amountOfMoney);
117: }
118: if (property_exists($object, 'contactPerson')) {
119: $this->contactPerson = $object->contactPerson;
120: }
121: if (property_exists($object, 'creationDetails')) {
122: if (!is_object($object->creationDetails)) {
123: throw new UnexpectedValueException('value \'' . print_r($object->creationDetails, true) . '\' is not an object');
124: }
125: $value = new DisputeCreationDetail();
126: $this->creationDetails = $value->fromObject($object->creationDetails);
127: }
128: if (property_exists($object, 'emailAddress')) {
129: $this->emailAddress = $object->emailAddress;
130: }
131: if (property_exists($object, 'files')) {
132: if (!is_array($object->files) && !is_object($object->files)) {
133: throw new UnexpectedValueException('value \'' . print_r($object->files, true) . '\' is not an array or object');
134: }
135: $this->files = [];
136: foreach ($object->files as $element) {
137: $value = new HostedFile();
138: $this->files[] = $value->fromObject($element);
139: }
140: }
141: if (property_exists($object, 'reference')) {
142: if (!is_object($object->reference)) {
143: throw new UnexpectedValueException('value \'' . print_r($object->reference, true) . '\' is not an object');
144: }
145: $value = new DisputeReference();
146: $this->reference = $value->fromObject($object->reference);
147: }
148: if (property_exists($object, 'replyTo')) {
149: $this->replyTo = $object->replyTo;
150: }
151: if (property_exists($object, 'requestMessage')) {
152: $this->requestMessage = $object->requestMessage;
153: }
154: if (property_exists($object, 'responseMessage')) {
155: $this->responseMessage = $object->responseMessage;
156: }
157: return $this;
158: }
159: }
160: