commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ShippingInfoBuilder.php
1<?php
2
3declare(strict_types=1);
10
27use stdClass;
28
32final class ShippingInfoBuilder implements Builder
33{
38 private $shippingMethodName;
39
44 private $price;
45
50 private $shippingRate;
51
56 private $taxedPrice;
57
62 private $taxRate;
63
68 private $taxCategory;
69
74 private $shippingMethod;
75
80 private $deliveries;
81
86 private $discountedPrice;
87
92 private $shippingMethodState;
93
100 public function getShippingMethodName()
101 {
102 return $this->shippingMethodName;
103 }
104
111 public function getPrice()
112 {
113 return $this->price instanceof CentPrecisionMoneyBuilder ? $this->price->build() : $this->price;
114 }
115
122 public function getShippingRate()
123 {
124 return $this->shippingRate instanceof ShippingRateBuilder ? $this->shippingRate->build() : $this->shippingRate;
125 }
126
133 public function getTaxedPrice()
134 {
135 return $this->taxedPrice instanceof TaxedItemPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice;
136 }
137
145 public function getTaxRate()
146 {
147 return $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate;
148 }
149
156 public function getTaxCategory()
157 {
158 return $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory;
159 }
160
167 public function getShippingMethod()
168 {
169 return $this->shippingMethod instanceof ShippingMethodReferenceBuilder ? $this->shippingMethod->build() : $this->shippingMethod;
170 }
171
178 public function getDeliveries()
179 {
180 return $this->deliveries;
181 }
182
189 public function getDiscountedPrice()
190 {
191 return $this->discountedPrice instanceof DiscountedLineItemPriceBuilder ? $this->discountedPrice->build() : $this->discountedPrice;
192 }
193
200 public function getShippingMethodState()
201 {
202 return $this->shippingMethodState;
203 }
204
209 public function withShippingMethodName(?string $shippingMethodName)
210 {
211 $this->shippingMethodName = $shippingMethodName;
212
213 return $this;
214 }
215
220 public function withPrice(?CentPrecisionMoney $price)
221 {
222 $this->price = $price;
223
224 return $this;
225 }
226
231 public function withShippingRate(?ShippingRate $shippingRate)
232 {
233 $this->shippingRate = $shippingRate;
234
235 return $this;
236 }
237
242 public function withTaxedPrice(?TaxedItemPrice $taxedPrice)
243 {
244 $this->taxedPrice = $taxedPrice;
245
246 return $this;
247 }
248
253 public function withTaxRate(?TaxRate $taxRate)
254 {
255 $this->taxRate = $taxRate;
256
257 return $this;
258 }
259
264 public function withTaxCategory(?TaxCategoryReference $taxCategory)
265 {
266 $this->taxCategory = $taxCategory;
267
268 return $this;
269 }
270
275 public function withShippingMethod(?ShippingMethodReference $shippingMethod)
276 {
277 $this->shippingMethod = $shippingMethod;
278
279 return $this;
280 }
281
286 public function withDeliveries(?DeliveryCollection $deliveries)
287 {
288 $this->deliveries = $deliveries;
289
290 return $this;
291 }
292
297 public function withDiscountedPrice(?DiscountedLineItemPrice $discountedPrice)
298 {
299 $this->discountedPrice = $discountedPrice;
300
301 return $this;
302 }
303
308 public function withShippingMethodState(?string $shippingMethodState)
309 {
310 $this->shippingMethodState = $shippingMethodState;
311
312 return $this;
313 }
314
320 {
321 $this->price = $price;
322
323 return $this;
324 }
325
330 public function withShippingRateBuilder(?ShippingRateBuilder $shippingRate)
331 {
332 $this->shippingRate = $shippingRate;
333
334 return $this;
335 }
336
341 public function withTaxedPriceBuilder(?TaxedItemPriceBuilder $taxedPrice)
342 {
343 $this->taxedPrice = $taxedPrice;
344
345 return $this;
346 }
347
352 public function withTaxRateBuilder(?TaxRateBuilder $taxRate)
353 {
354 $this->taxRate = $taxRate;
355
356 return $this;
357 }
358
364 {
365 $this->taxCategory = $taxCategory;
366
367 return $this;
368 }
369
375 {
376 $this->shippingMethod = $shippingMethod;
377
378 return $this;
379 }
380
386 {
387 $this->discountedPrice = $discountedPrice;
388
389 return $this;
390 }
391
392 public function build(): ShippingInfo
393 {
394 return new ShippingInfoModel(
395 $this->shippingMethodName,
396 $this->price instanceof CentPrecisionMoneyBuilder ? $this->price->build() : $this->price,
397 $this->shippingRate instanceof ShippingRateBuilder ? $this->shippingRate->build() : $this->shippingRate,
398 $this->taxedPrice instanceof TaxedItemPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice,
399 $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate,
400 $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
401 $this->shippingMethod instanceof ShippingMethodReferenceBuilder ? $this->shippingMethod->build() : $this->shippingMethod,
402 $this->deliveries,
403 $this->discountedPrice instanceof DiscountedLineItemPriceBuilder ? $this->discountedPrice->build() : $this->discountedPrice,
404 $this->shippingMethodState
405 );
406 }
407
408 public static function of(): ShippingInfoBuilder
409 {
410 return new self();
411 }
412}
withDiscountedPrice(?DiscountedLineItemPrice $discountedPrice)
withTaxedPriceBuilder(?TaxedItemPriceBuilder $taxedPrice)
withDiscountedPriceBuilder(?DiscountedLineItemPriceBuilder $discountedPrice)
withTaxCategoryBuilder(?TaxCategoryReferenceBuilder $taxCategory)
withShippingRateBuilder(?ShippingRateBuilder $shippingRate)
withTaxCategory(?TaxCategoryReference $taxCategory)
withShippingMethod(?ShippingMethodReference $shippingMethod)
withPriceBuilder(?CentPrecisionMoneyBuilder $price)
withShippingMethodBuilder(?ShippingMethodReferenceBuilder $shippingMethod)