commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ZoneRateDraftModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
22final class ZoneRateDraftModel extends JsonObjectModel implements ZoneRateDraft
23{
28 protected $zone;
29
34 protected $shippingRates;
35
36
40 public function __construct(
43 ) {
44 $this->zone = $zone;
45 $this->shippingRates = $shippingRates;
46 }
47
54 public function getZone()
55 {
56 if (is_null($this->zone)) {
58 $data = $this->raw(self::FIELD_ZONE);
59 if (is_null($data)) {
60 return null;
61 }
62
63 $this->zone = ZoneResourceIdentifierModel::of($data);
64 }
65
66 return $this->zone;
67 }
68
75 public function getShippingRates()
76 {
77 if (is_null($this->shippingRates)) {
79 $data = $this->raw(self::FIELD_SHIPPING_RATES);
80 if (is_null($data)) {
81 return null;
82 }
83 $this->shippingRates = ShippingRateDraftCollection::fromArray($data);
84 }
85
87 }
88
89
93 public function setZone(?ZoneResourceIdentifier $zone): void
94 {
95 $this->zone = $zone;
96 }
97
102 {
103 $this->shippingRates = $shippingRates;
104 }
105}
__construct(?ZoneResourceIdentifier $zone=null, ?ShippingRateDraftCollection $shippingRates=null)
setShippingRates(?ShippingRateDraftCollection $shippingRates)
static fromArray(array $data)