commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ShippingRateDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $price;
29 
34  protected $freeAbove;
35 
40  protected $tiers;
41 
42 
46  public function __construct(
47  ?Money $price = null,
48  ?Money $freeAbove = null,
50  ) {
51  $this->price = $price;
52  $this->freeAbove = $freeAbove;
53  $this->tiers = $tiers;
54  }
55 
60  public function getPrice()
61  {
62  if (is_null($this->price)) {
64  $data = $this->raw(self::FIELD_PRICE);
65  if (is_null($data)) {
66  return null;
67  }
68 
69  $this->price = MoneyModel::of($data);
70  }
71 
72  return $this->price;
73  }
74 
79  public function getFreeAbove()
80  {
81  if (is_null($this->freeAbove)) {
83  $data = $this->raw(self::FIELD_FREE_ABOVE);
84  if (is_null($data)) {
85  return null;
86  }
87 
88  $this->freeAbove = MoneyModel::of($data);
89  }
90 
91  return $this->freeAbove;
92  }
93 
98  public function getTiers()
99  {
100  if (is_null($this->tiers)) {
102  $data = $this->raw(self::FIELD_TIERS);
103  if (is_null($data)) {
104  return null;
105  }
106  $this->tiers = ShippingRatePriceTierCollection::fromArray($data);
107  }
108 
109  return $this->tiers;
110  }
111 
112 
116  public function setPrice(?Money $price): void
117  {
118  $this->price = $price;
119  }
120 
124  public function setFreeAbove(?Money $freeAbove): void
125  {
126  $this->freeAbove = $freeAbove;
127  }
128 
133  {
134  $this->tiers = $tiers;
135  }
136 }
__construct(?Money $price=null, ?Money $freeAbove=null, ?ShippingRatePriceTierCollection $tiers=null)