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