commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
StandalonePriceImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
29 use DateTimeImmutable;
30 use stdClass;
31 
35 final class StandalonePriceImportBuilder implements Builder
36 {
41  private $key;
42 
47  private $sku;
48 
53  private $value;
54 
59  private $country;
60 
65  private $customerGroup;
66 
71  private $channel;
72 
77  private $validFrom;
78 
83  private $validUntil;
84 
89  private $tiers;
90 
95  private $discounted;
96 
101  private $custom;
102 
109  public function getKey()
110  {
111  return $this->key;
112  }
113 
120  public function getSku()
121  {
122  return $this->sku;
123  }
124 
131  public function getValue()
132  {
133  return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
134  }
135 
143  public function getCountry()
144  {
145  return $this->country;
146  }
147 
155  public function getCustomerGroup()
156  {
157  return $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
158  }
159 
167  public function getChannel()
168  {
169  return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
170  }
171 
178  public function getValidFrom()
179  {
180  return $this->validFrom;
181  }
182 
189  public function getValidUntil()
190  {
191  return $this->validUntil;
192  }
193 
200  public function getTiers()
201  {
202  return $this->tiers;
203  }
204 
211  public function getDiscounted()
212  {
213  return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
214  }
215 
222  public function getCustom()
223  {
224  return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
225  }
226 
231  public function withKey(?string $key)
232  {
233  $this->key = $key;
234 
235  return $this;
236  }
237 
242  public function withSku(?string $sku)
243  {
244  $this->sku = $sku;
245 
246  return $this;
247  }
248 
253  public function withValue(?TypedMoney $value)
254  {
255  $this->value = $value;
256 
257  return $this;
258  }
259 
264  public function withCountry(?string $country)
265  {
266  $this->country = $country;
267 
268  return $this;
269  }
270 
275  public function withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
276  {
277  $this->customerGroup = $customerGroup;
278 
279  return $this;
280  }
281 
286  public function withChannel(?ChannelKeyReference $channel)
287  {
288  $this->channel = $channel;
289 
290  return $this;
291  }
292 
297  public function withValidFrom(?DateTimeImmutable $validFrom)
298  {
299  $this->validFrom = $validFrom;
300 
301  return $this;
302  }
303 
308  public function withValidUntil(?DateTimeImmutable $validUntil)
309  {
310  $this->validUntil = $validUntil;
311 
312  return $this;
313  }
314 
319  public function withTiers(?PriceTierCollection $tiers)
320  {
321  $this->tiers = $tiers;
322 
323  return $this;
324  }
325 
330  public function withDiscounted(?DiscountedPrice $discounted)
331  {
332  $this->discounted = $discounted;
333 
334  return $this;
335  }
336 
341  public function withCustom(?Custom $custom)
342  {
343  $this->custom = $custom;
344 
345  return $this;
346  }
347 
352  public function withValueBuilder(?TypedMoneyBuilder $value)
353  {
354  $this->value = $value;
355 
356  return $this;
357  }
358 
364  {
365  $this->customerGroup = $customerGroup;
366 
367  return $this;
368  }
369 
375  {
376  $this->channel = $channel;
377 
378  return $this;
379  }
380 
385  public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
386  {
387  $this->discounted = $discounted;
388 
389  return $this;
390  }
391 
396  public function withCustomBuilder(?CustomBuilder $custom)
397  {
398  $this->custom = $custom;
399 
400  return $this;
401  }
402 
403  public function build(): StandalonePriceImport
404  {
405  return new StandalonePriceImportModel(
406  $this->key,
407  $this->sku,
408  $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
409  $this->country,
410  $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
411  $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
412  $this->validFrom,
413  $this->validUntil,
414  $this->tiers,
415  $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
416  $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
417  );
418  }
419 
420  public static function of(): StandalonePriceImportBuilder
421  {
422  return new self();
423  }
424 }