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