commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
CartClassificationTierModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'CartClassification';
29  protected $type;
30 
35  protected $value;
36 
41  protected $price;
42 
47  protected $tiers;
48 
53  protected $isMatching;
54 
55 
59  public function __construct(
60  ?string $value = null,
61  ?Money $price = null,
63  ?bool $isMatching = null,
64  ?string $type = null
65  ) {
66  $this->value = $value;
67  $this->price = $price;
68  $this->tiers = $tiers;
69  $this->isMatching = $isMatching;
70  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
71  }
72 
77  public function getType()
78  {
79  if (is_null($this->type)) {
81  $data = $this->raw(self::FIELD_TYPE);
82  if (is_null($data)) {
83  return null;
84  }
85  $this->type = (string) $data;
86  }
87 
88  return $this->type;
89  }
90 
95  public function getValue()
96  {
97  if (is_null($this->value)) {
99  $data = $this->raw(self::FIELD_VALUE);
100  if (is_null($data)) {
101  return null;
102  }
103  $this->value = (string) $data;
104  }
105 
106  return $this->value;
107  }
108 
113  public function getPrice()
114  {
115  if (is_null($this->price)) {
117  $data = $this->raw(self::FIELD_PRICE);
118  if (is_null($data)) {
119  return null;
120  }
121 
122  $this->price = MoneyModel::of($data);
123  }
124 
125  return $this->price;
126  }
127 
132  public function getTiers()
133  {
134  if (is_null($this->tiers)) {
136  $data = $this->raw(self::FIELD_TIERS);
137  if (is_null($data)) {
138  return null;
139  }
140  $this->tiers = ShippingRatePriceTierCollection::fromArray($data);
141  }
142 
143  return $this->tiers;
144  }
145 
150  public function getIsMatching()
151  {
152  if (is_null($this->isMatching)) {
154  $data = $this->raw(self::FIELD_IS_MATCHING);
155  if (is_null($data)) {
156  return null;
157  }
158  $this->isMatching = (bool) $data;
159  }
160 
161  return $this->isMatching;
162  }
163 
164 
168  public function setValue(?string $value): void
169  {
170  $this->value = $value;
171  }
172 
176  public function setPrice(?Money $price): void
177  {
178  $this->price = $price;
179  }
180 
185  {
186  $this->tiers = $tiers;
187  }
188 
192  public function setIsMatching(?bool $isMatching): void
193  {
194  $this->isMatching = $isMatching;
195  }
196 }
__construct(?string $value=null, ?Money $price=null, ?ShippingRatePriceTierCollection $tiers=null, ?bool $isMatching=null, ?string $type=null)