commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ShippingModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
24final class ShippingModel extends JsonObjectModel implements Shipping
25{
30 protected $shippingKey;
31
36 protected $shippingInfo;
37
43
49
55
56
60 public function __construct(
61 ?string $shippingKey = null,
66 ) {
67 $this->shippingKey = $shippingKey;
68 $this->shippingInfo = $shippingInfo;
69 $this->shippingAddress = $shippingAddress;
70 $this->shippingRateInput = $shippingRateInput;
71 $this->shippingCustomFields = $shippingCustomFields;
72 }
73
80 public function getShippingKey()
81 {
82 if (is_null($this->shippingKey)) {
84 $data = $this->raw(self::FIELD_SHIPPING_KEY);
85 if (is_null($data)) {
86 return null;
87 }
88 $this->shippingKey = (string) $data;
89 }
90
91 return $this->shippingKey;
92 }
93
100 public function getShippingInfo()
101 {
102 if (is_null($this->shippingInfo)) {
104 $data = $this->raw(self::FIELD_SHIPPING_INFO);
105 if (is_null($data)) {
106 return null;
107 }
108
109 $this->shippingInfo = ShippingInfoModel::of($data);
110 }
111
112 return $this->shippingInfo;
113 }
114
121 public function getShippingAddress()
122 {
123 if (is_null($this->shippingAddress)) {
125 $data = $this->raw(self::FIELD_SHIPPING_ADDRESS);
126 if (is_null($data)) {
127 return null;
128 }
129
130 $this->shippingAddress = AddressModel::of($data);
131 }
132
134 }
135
148 public function getShippingRateInput()
149 {
150 if (is_null($this->shippingRateInput)) {
152 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT);
153 if (is_null($data)) {
154 return null;
155 }
157 $this->shippingRateInput = $className::of($data);
158 }
159
161 }
162
169 public function getShippingCustomFields()
170 {
171 if (is_null($this->shippingCustomFields)) {
173 $data = $this->raw(self::FIELD_SHIPPING_CUSTOM_FIELDS);
174 if (is_null($data)) {
175 return null;
176 }
177
178 $this->shippingCustomFields = CustomFieldsModel::of($data);
179 }
180
182 }
183
184
188 public function setShippingKey(?string $shippingKey): void
189 {
190 $this->shippingKey = $shippingKey;
191 }
192
197 {
198 $this->shippingInfo = $shippingInfo;
199 }
200
205 {
206 $this->shippingAddress = $shippingAddress;
207 }
208
213 {
214 $this->shippingRateInput = $shippingRateInput;
215 }
216
221 {
222 $this->shippingCustomFields = $shippingCustomFields;
223 }
224}
setShippingInfo(?ShippingInfo $shippingInfo)
setShippingRateInput(?ShippingRateInput $shippingRateInput)
setShippingAddress(?Address $shippingAddress)
setShippingCustomFields(?CustomFields $shippingCustomFields)
__construct(?string $shippingKey=null, ?ShippingInfo $shippingInfo=null, ?Address $shippingAddress=null, ?ShippingRateInput $shippingRateInput=null, ?CustomFields $shippingCustomFields=null)