commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CartValueTierModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class CartValueTierModel extends JsonObjectModel implements CartValueTier
23 {
24  public const DISCRIMINATOR_VALUE = 'CartValue';
29  protected $type;
30 
35  protected $minimumCentAmount;
36 
41  protected $price;
42 
47  protected $isMatching;
48 
49 
53  public function __construct(
54  ?int $minimumCentAmount = null,
55  ?Money $price = null,
56  ?bool $isMatching = null,
57  ?string $type = null
58  ) {
59  $this->minimumCentAmount = $minimumCentAmount;
60  $this->price = $price;
61  $this->isMatching = $isMatching;
62  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
63  }
64 
69  public function getType()
70  {
71  if (is_null($this->type)) {
73  $data = $this->raw(self::FIELD_TYPE);
74  if (is_null($data)) {
75  return null;
76  }
77  $this->type = (string) $data;
78  }
79 
80  return $this->type;
81  }
82 
89  public function getMinimumCentAmount()
90  {
91  if (is_null($this->minimumCentAmount)) {
93  $data = $this->raw(self::FIELD_MINIMUM_CENT_AMOUNT);
94  if (is_null($data)) {
95  return null;
96  }
97  $this->minimumCentAmount = (int) $data;
98  }
99 
101  }
102 
109  public function getPrice()
110  {
111  if (is_null($this->price)) {
113  $data = $this->raw(self::FIELD_PRICE);
114  if (is_null($data)) {
115  return null;
116  }
117 
118  $this->price = MoneyModel::of($data);
119  }
120 
121  return $this->price;
122  }
123 
130  public function getIsMatching()
131  {
132  if (is_null($this->isMatching)) {
134  $data = $this->raw(self::FIELD_IS_MATCHING);
135  if (is_null($data)) {
136  return null;
137  }
138  $this->isMatching = (bool) $data;
139  }
140 
141  return $this->isMatching;
142  }
143 
144 
148  public function setMinimumCentAmount(?int $minimumCentAmount): void
149  {
150  $this->minimumCentAmount = $minimumCentAmount;
151  }
152 
156  public function setPrice(?Money $price): void
157  {
158  $this->price = $price;
159  }
160 
164  public function setIsMatching(?bool $isMatching): void
165  {
166  $this->isMatching = $isMatching;
167  }
168 }
__construct(?int $minimumCentAmount=null, ?Money $price=null, ?bool $isMatching=null, ?string $type=null)