1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | use Worldline\Connect\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class DisputeOutput extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $amountOfMoney = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $contactPerson = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $creationDetails = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $emailAddress = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $files = null; |
40: | |
41: | |
42: | |
43: | |
44: | public $reference = null; |
45: | |
46: | |
47: | |
48: | |
49: | public $replyTo = null; |
50: | |
51: | |
52: | |
53: | |
54: | public $requestMessage = null; |
55: | |
56: | |
57: | |
58: | |
59: | public $responseMessage = null; |
60: | |
61: | |
62: | |
63: | |
64: | public function toObject() |
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: | |
104: | |
105: | |
106: | |
107: | public function fromObject($object) |
108: | { |
109: | parent::fromObject($object); |
110: | if (property_exists($object, 'amountOfMoney')) { |
111: | if (!is_object($object->amountOfMoney)) { |
112: | throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); |
113: | } |
114: | $value = new AmountOfMoney(); |
115: | $this->amountOfMoney = $value->fromObject($object->amountOfMoney); |
116: | } |
117: | if (property_exists($object, 'contactPerson')) { |
118: | $this->contactPerson = $object->contactPerson; |
119: | } |
120: | if (property_exists($object, 'creationDetails')) { |
121: | if (!is_object($object->creationDetails)) { |
122: | throw new UnexpectedValueException('value \'' . print_r($object->creationDetails, true) . '\' is not an object'); |
123: | } |
124: | $value = new DisputeCreationDetail(); |
125: | $this->creationDetails = $value->fromObject($object->creationDetails); |
126: | } |
127: | if (property_exists($object, 'emailAddress')) { |
128: | $this->emailAddress = $object->emailAddress; |
129: | } |
130: | if (property_exists($object, 'files')) { |
131: | if (!is_array($object->files) && !is_object($object->files)) { |
132: | throw new UnexpectedValueException('value \'' . print_r($object->files, true) . '\' is not an array or object'); |
133: | } |
134: | $this->files = []; |
135: | foreach ($object->files as $element) { |
136: | $value = new HostedFile(); |
137: | $this->files[] = $value->fromObject($element); |
138: | } |
139: | } |
140: | if (property_exists($object, 'reference')) { |
141: | if (!is_object($object->reference)) { |
142: | throw new UnexpectedValueException('value \'' . print_r($object->reference, true) . '\' is not an object'); |
143: | } |
144: | $value = new DisputeReference(); |
145: | $this->reference = $value->fromObject($object->reference); |
146: | } |
147: | if (property_exists($object, 'replyTo')) { |
148: | $this->replyTo = $object->replyTo; |
149: | } |
150: | if (property_exists($object, 'requestMessage')) { |
151: | $this->requestMessage = $object->requestMessage; |
152: | } |
153: | if (property_exists($object, 'responseMessage')) { |
154: | $this->responseMessage = $object->responseMessage; |
155: | } |
156: | return $this; |
157: | } |
158: | } |
159: | |