commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
PriceImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
33 use DateTimeImmutable;
34 use stdClass;
35 
39 final class PriceImportBuilder implements Builder
40 {
45  private $key;
46 
51  private $value;
52 
57  private $country;
58 
63  private $validFrom;
64 
69  private $validUntil;
70 
75  private $customerGroup;
76 
81  private $channel;
82 
87  private $discounted;
88 
93  private $staged;
94 
99  private $tiers;
100 
105  private $custom;
106 
111  private $productVariant;
112 
117  private $product;
118 
125  public function getKey()
126  {
127  return $this->key;
128  }
129 
136  public function getValue()
137  {
138  return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
139  }
140 
147  public function getCountry()
148  {
149  return $this->country;
150  }
151 
158  public function getValidFrom()
159  {
160  return $this->validFrom;
161  }
162 
169  public function getValidUntil()
170  {
171  return $this->validUntil;
172  }
173 
181  public function getCustomerGroup()
182  {
183  return $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
184  }
185 
193  public function getChannel()
194  {
195  return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
196  }
197 
204  public function getDiscounted()
205  {
206  return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
207  }
208 
218  public function getStaged()
219  {
220  return $this->staged;
221  }
222 
229  public function getTiers()
230  {
231  return $this->tiers;
232  }
233 
240  public function getCustom()
241  {
242  return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
243  }
244 
253  public function getProductVariant()
254  {
255  return $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant;
256  }
257 
266  public function getProduct()
267  {
268  return $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product;
269  }
270 
275  public function withKey(?string $key)
276  {
277  $this->key = $key;
278 
279  return $this;
280  }
281 
286  public function withValue(?TypedMoney $value)
287  {
288  $this->value = $value;
289 
290  return $this;
291  }
292 
297  public function withCountry(?string $country)
298  {
299  $this->country = $country;
300 
301  return $this;
302  }
303 
308  public function withValidFrom(?DateTimeImmutable $validFrom)
309  {
310  $this->validFrom = $validFrom;
311 
312  return $this;
313  }
314 
319  public function withValidUntil(?DateTimeImmutable $validUntil)
320  {
321  $this->validUntil = $validUntil;
322 
323  return $this;
324  }
325 
330  public function withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
331  {
332  $this->customerGroup = $customerGroup;
333 
334  return $this;
335  }
336 
341  public function withChannel(?ChannelKeyReference $channel)
342  {
343  $this->channel = $channel;
344 
345  return $this;
346  }
347 
352  public function withDiscounted(?DiscountedPrice $discounted)
353  {
354  $this->discounted = $discounted;
355 
356  return $this;
357  }
358 
363  public function withStaged(?bool $staged)
364  {
365  $this->staged = $staged;
366 
367  return $this;
368  }
369 
374  public function withTiers(?PriceTierCollection $tiers)
375  {
376  $this->tiers = $tiers;
377 
378  return $this;
379  }
380 
385  public function withCustom(?Custom $custom)
386  {
387  $this->custom = $custom;
388 
389  return $this;
390  }
391 
396  public function withProductVariant(?ProductVariantKeyReference $productVariant)
397  {
398  $this->productVariant = $productVariant;
399 
400  return $this;
401  }
402 
407  public function withProduct(?ProductKeyReference $product)
408  {
409  $this->product = $product;
410 
411  return $this;
412  }
413 
418  public function withValueBuilder(?TypedMoneyBuilder $value)
419  {
420  $this->value = $value;
421 
422  return $this;
423  }
424 
430  {
431  $this->customerGroup = $customerGroup;
432 
433  return $this;
434  }
435 
441  {
442  $this->channel = $channel;
443 
444  return $this;
445  }
446 
451  public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
452  {
453  $this->discounted = $discounted;
454 
455  return $this;
456  }
457 
462  public function withCustomBuilder(?CustomBuilder $custom)
463  {
464  $this->custom = $custom;
465 
466  return $this;
467  }
468 
474  {
475  $this->productVariant = $productVariant;
476 
477  return $this;
478  }
479 
485  {
486  $this->product = $product;
487 
488  return $this;
489  }
490 
491  public function build(): PriceImport
492  {
493  return new PriceImportModel(
494  $this->key,
495  $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
496  $this->country,
497  $this->validFrom,
498  $this->validUntil,
499  $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
500  $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
501  $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
502  $this->staged,
503  $this->tiers,
504  $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom,
505  $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant,
506  $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product
507  );
508  }
509 
510  public static function of(): PriceImportBuilder
511  {
512  return new self();
513  }
514 }
withChannelBuilder(?ChannelKeyReferenceBuilder $channel)
withProductVariantBuilder(?ProductVariantKeyReferenceBuilder $productVariant)
withCustomerGroupBuilder(?CustomerGroupKeyReferenceBuilder $customerGroup)
withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
withProductVariant(?ProductVariantKeyReference $productVariant)
withProductBuilder(?ProductKeyReferenceBuilder $product)
withCustomerGroup(?CustomerGroupKeyReference $customerGroup)