commercetools-sdk-php-v2  master
The platform, import-api and ml-api 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 $publish;
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 
215  public function getPublish()
216  {
217  return $this->publish;
218  }
219 
226  public function getTiers()
227  {
228  return $this->tiers;
229  }
230 
237  public function getCustom()
238  {
239  return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
240  }
241 
250  public function getProductVariant()
251  {
252  return $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant;
253  }
254 
263  public function getProduct()
264  {
265  return $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product;
266  }
267 
272  public function withKey(?string $key)
273  {
274  $this->key = $key;
275 
276  return $this;
277  }
278 
283  public function withValue(?TypedMoney $value)
284  {
285  $this->value = $value;
286 
287  return $this;
288  }
289 
294  public function withCountry(?string $country)
295  {
296  $this->country = $country;
297 
298  return $this;
299  }
300 
305  public function withValidFrom(?DateTimeImmutable $validFrom)
306  {
307  $this->validFrom = $validFrom;
308 
309  return $this;
310  }
311 
316  public function withValidUntil(?DateTimeImmutable $validUntil)
317  {
318  $this->validUntil = $validUntil;
319 
320  return $this;
321  }
322 
327  public function withCustomerGroup(?CustomerGroupKeyReference $customerGroup)
328  {
329  $this->customerGroup = $customerGroup;
330 
331  return $this;
332  }
333 
338  public function withChannel(?ChannelKeyReference $channel)
339  {
340  $this->channel = $channel;
341 
342  return $this;
343  }
344 
349  public function withDiscounted(?DiscountedPrice $discounted)
350  {
351  $this->discounted = $discounted;
352 
353  return $this;
354  }
355 
360  public function withPublish(?bool $publish)
361  {
362  $this->publish = $publish;
363 
364  return $this;
365  }
366 
371  public function withTiers(?PriceTierCollection $tiers)
372  {
373  $this->tiers = $tiers;
374 
375  return $this;
376  }
377 
382  public function withCustom(?Custom $custom)
383  {
384  $this->custom = $custom;
385 
386  return $this;
387  }
388 
393  public function withProductVariant(?ProductVariantKeyReference $productVariant)
394  {
395  $this->productVariant = $productVariant;
396 
397  return $this;
398  }
399 
404  public function withProduct(?ProductKeyReference $product)
405  {
406  $this->product = $product;
407 
408  return $this;
409  }
410 
415  public function withValueBuilder(?TypedMoneyBuilder $value)
416  {
417  $this->value = $value;
418 
419  return $this;
420  }
421 
427  {
428  $this->customerGroup = $customerGroup;
429 
430  return $this;
431  }
432 
438  {
439  $this->channel = $channel;
440 
441  return $this;
442  }
443 
448  public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
449  {
450  $this->discounted = $discounted;
451 
452  return $this;
453  }
454 
459  public function withCustomBuilder(?CustomBuilder $custom)
460  {
461  $this->custom = $custom;
462 
463  return $this;
464  }
465 
471  {
472  $this->productVariant = $productVariant;
473 
474  return $this;
475  }
476 
482  {
483  $this->product = $product;
484 
485  return $this;
486  }
487 
488  public function build(): PriceImport
489  {
490  return new PriceImportModel(
491  $this->key,
492  $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
493  $this->country,
494  $this->validFrom,
495  $this->validUntil,
496  $this->customerGroup instanceof CustomerGroupKeyReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
497  $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
498  $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
499  $this->publish,
500  $this->tiers,
501  $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom,
502  $this->productVariant instanceof ProductVariantKeyReferenceBuilder ? $this->productVariant->build() : $this->productVariant,
503  $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product
504  );
505  }
506 
507  public static function of(): PriceImportBuilder
508  {
509  return new self();
510  }
511 }
withChannelBuilder(?ChannelKeyReferenceBuilder $channel)
withProductVariantBuilder(?ProductVariantKeyReferenceBuilder $productVariant)
withCustomerGroupBuilder(?CustomerGroupKeyReferenceBuilder $customerGroup)
withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
withProductVariant(?ProductVariantKeyReference $productVariant)
withProductBuilder(?ProductKeyReferenceBuilder $product)
withCustomerGroup(?CustomerGroupKeyReference $customerGroup)