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