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