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 $comments = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $emailAddress = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $firstUsageDate = null; |
40: | |
41: | |
42: | |
43: | |
44: | public $isFirstUsage = null; |
45: | |
46: | |
47: | |
48: | |
49: | public $shippedFromZip = null; |
50: | |
51: | |
52: | |
53: | |
54: | public $trackingNumber = null; |
55: | |
56: | |
57: | |
58: | |
59: | public $type = null; |
60: | |
61: | |
62: | |
63: | |
64: | public function toObject() |
65: | { |
66: | $object = parent::toObject(); |
67: | if (!is_null($this->address)) { |
68: | $object->address = $this->address->toObject(); |
69: | } |
70: | if (!is_null($this->addressIndicator)) { |
71: | $object->addressIndicator = $this->addressIndicator; |
72: | } |
73: | if (!is_null($this->comments)) { |
74: | $object->comments = $this->comments; |
75: | } |
76: | if (!is_null($this->emailAddress)) { |
77: | $object->emailAddress = $this->emailAddress; |
78: | } |
79: | if (!is_null($this->firstUsageDate)) { |
80: | $object->firstUsageDate = $this->firstUsageDate; |
81: | } |
82: | if (!is_null($this->isFirstUsage)) { |
83: | $object->isFirstUsage = $this->isFirstUsage; |
84: | } |
85: | if (!is_null($this->shippedFromZip)) { |
86: | $object->shippedFromZip = $this->shippedFromZip; |
87: | } |
88: | if (!is_null($this->trackingNumber)) { |
89: | $object->trackingNumber = $this->trackingNumber; |
90: | } |
91: | if (!is_null($this->type)) { |
92: | $object->type = $this->type; |
93: | } |
94: | return $object; |
95: | } |
96: | |
97: | |
98: | |
99: | |
100: | |
101: | |
102: | public function fromObject($object) |
103: | { |
104: | parent::fromObject($object); |
105: | if (property_exists($object, 'address')) { |
106: | if (!is_object($object->address)) { |
107: | throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); |
108: | } |
109: | $value = new AddressPersonal(); |
110: | $this->address = $value->fromObject($object->address); |
111: | } |
112: | if (property_exists($object, 'addressIndicator')) { |
113: | $this->addressIndicator = $object->addressIndicator; |
114: | } |
115: | if (property_exists($object, 'comments')) { |
116: | $this->comments = $object->comments; |
117: | } |
118: | if (property_exists($object, 'emailAddress')) { |
119: | $this->emailAddress = $object->emailAddress; |
120: | } |
121: | if (property_exists($object, 'firstUsageDate')) { |
122: | $this->firstUsageDate = $object->firstUsageDate; |
123: | } |
124: | if (property_exists($object, 'isFirstUsage')) { |
125: | $this->isFirstUsage = $object->isFirstUsage; |
126: | } |
127: | if (property_exists($object, 'shippedFromZip')) { |
128: | $this->shippedFromZip = $object->shippedFromZip; |
129: | } |
130: | if (property_exists($object, 'trackingNumber')) { |
131: | $this->trackingNumber = $object->trackingNumber; |
132: | } |
133: | if (property_exists($object, 'type')) { |
134: | $this->type = $object->type; |
135: | } |
136: | return $this; |
137: | } |
138: | } |
139: | |