commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ZoneRateBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class ZoneRateBuilder implements Builder
24 {
29  private $zone;
30 
35  private $shippingRates;
36 
43  public function getZone()
44  {
45  return $this->zone instanceof ZoneReferenceBuilder ? $this->zone->build() : $this->zone;
46  }
47 
54  public function getShippingRates()
55  {
56  return $this->shippingRates;
57  }
58 
63  public function withZone(?ZoneReference $zone)
64  {
65  $this->zone = $zone;
66 
67  return $this;
68  }
69 
74  public function withShippingRates(?ShippingRateCollection $shippingRates)
75  {
76  $this->shippingRates = $shippingRates;
77 
78  return $this;
79  }
80 
85  public function withZoneBuilder(?ZoneReferenceBuilder $zone)
86  {
87  $this->zone = $zone;
88 
89  return $this;
90  }
91 
92  public function build(): ZoneRate
93  {
94  return new ZoneRateModel(
95  $this->zone instanceof ZoneReferenceBuilder ? $this->zone->build() : $this->zone,
96  $this->shippingRates
97  );
98  }
99 
100  public static function of(): ZoneRateBuilder
101  {
102  return new self();
103  }
104 }
withShippingRates(?ShippingRateCollection $shippingRates)