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 ShippingRiskAssessment extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $address = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $comments = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $trackingNumber = null; |
30: | |
31: | |
32: | |
33: | |
34: | public function toObject() |
35: | { |
36: | $object = parent::toObject(); |
37: | if (!is_null($this->address)) { |
38: | $object->address = $this->address->toObject(); |
39: | } |
40: | if (!is_null($this->comments)) { |
41: | $object->comments = $this->comments; |
42: | } |
43: | if (!is_null($this->trackingNumber)) { |
44: | $object->trackingNumber = $this->trackingNumber; |
45: | } |
46: | return $object; |
47: | } |
48: | |
49: | |
50: | |
51: | |
52: | |
53: | |
54: | public function fromObject($object) |
55: | { |
56: | parent::fromObject($object); |
57: | if (property_exists($object, 'address')) { |
58: | if (!is_object($object->address)) { |
59: | throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object'); |
60: | } |
61: | $value = new AddressPersonal(); |
62: | $this->address = $value->fromObject($object->address); |
63: | } |
64: | if (property_exists($object, 'comments')) { |
65: | $this->comments = $object->comments; |
66: | } |
67: | if (property_exists($object, 'trackingNumber')) { |
68: | $this->trackingNumber = $object->trackingNumber; |
69: | } |
70: | return $this; |
71: | } |
72: | } |
73: | |