1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class Shipping extends DataObject
15: {
16: /**
17: * @var AddressPersonal|null
18: */
19: public ?AddressPersonal $address = null;
20:
21: /**
22: * @var string|null
23: */
24: public ?string $addressIndicator = null;
25:
26: /**
27: * @var string|null
28: */
29: public ?string $carrier = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $comments = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $emailAddress = null;
40:
41: /**
42: * @var string|null
43: */
44: public ?string $firstUsageDate = null;
45:
46: /**
47: * @var string|null
48: */
49: public ?string $instructions = null;
50:
51: /**
52: * @var bool|null
53: */
54: public ?bool $isFirstUsage = null;
55:
56: /**
57: * @var string|null
58: */
59: public ?string $shippedFromZip = null;
60:
61: /**
62: * @var string|null
63: */
64: public ?string $trackingNumber = null;
65:
66: /**
67: * @var string|null
68: */
69: public ?string $type = null;
70:
71: /**
72: * @return object
73: */
74: public function toObject(): object
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: * @param object $object
115: *
116: * @return $this
117: * @throws UnexpectedValueException
118: */
119: public function fromObject(object $object): Shipping
120: {
121: parent::fromObject($object);
122: if (property_exists($object, 'address')) {
123: if (!is_object($object->address)) {
124: throw new UnexpectedValueException('value \'' . print_r($object->address, true) . '\' is not an object');
125: }
126: $value = new AddressPersonal();
127: $this->address = $value->fromObject($object->address);
128: }
129: if (property_exists($object, 'addressIndicator')) {
130: $this->addressIndicator = $object->addressIndicator;
131: }
132: if (property_exists($object, 'carrier')) {
133: $this->carrier = $object->carrier;
134: }
135: if (property_exists($object, 'comments')) {
136: $this->comments = $object->comments;
137: }
138: if (property_exists($object, 'emailAddress')) {
139: $this->emailAddress = $object->emailAddress;
140: }
141: if (property_exists($object, 'firstUsageDate')) {
142: $this->firstUsageDate = $object->firstUsageDate;
143: }
144: if (property_exists($object, 'instructions')) {
145: $this->instructions = $object->instructions;
146: }
147: if (property_exists($object, 'isFirstUsage')) {
148: $this->isFirstUsage = $object->isFirstUsage;
149: }
150: if (property_exists($object, 'shippedFromZip')) {
151: $this->shippedFromZip = $object->shippedFromZip;
152: }
153: if (property_exists($object, 'trackingNumber')) {
154: $this->trackingNumber = $object->trackingNumber;
155: }
156: if (property_exists($object, 'type')) {
157: $this->type = $object->type;
158: }
159: return $this;
160: }
161: }
162: