commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
StandalonePriceBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
33 use DateTimeImmutable;
34 use stdClass;
35 
39 final class StandalonePriceBuilder implements Builder
40 {
45  private $id;
46 
51  private $version;
52 
57  private $createdAt;
58 
63  private $lastModifiedAt;
64 
69  private $lastModifiedBy;
70 
75  private $createdBy;
76 
81  private $key;
82 
87  private $sku;
88 
93  private $value;
94 
99  private $country;
100 
105  private $customerGroup;
106 
111  private $channel;
112 
117  private $validFrom;
118 
123  private $validUntil;
124 
129  private $tiers;
130 
135  private $discounted;
136 
141  private $custom;
142 
147  private $staged;
148 
153  private $active;
154 
161  public function getId()
162  {
163  return $this->id;
164  }
165 
172  public function getVersion()
173  {
174  return $this->version;
175  }
176 
183  public function getCreatedAt()
184  {
185  return $this->createdAt;
186  }
187 
194  public function getLastModifiedAt()
195  {
196  return $this->lastModifiedAt;
197  }
198 
205  public function getLastModifiedBy()
206  {
207  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
208  }
209 
216  public function getCreatedBy()
217  {
218  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
219  }
220 
227  public function getKey()
228  {
229  return $this->key;
230  }
231 
238  public function getSku()
239  {
240  return $this->sku;
241  }
242 
249  public function getValue()
250  {
251  return $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value;
252  }
253 
260  public function getCountry()
261  {
262  return $this->country;
263  }
264 
271  public function getCustomerGroup()
272  {
273  return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
274  }
275 
282  public function getChannel()
283  {
284  return $this->channel instanceof ChannelReferenceBuilder ? $this->channel->build() : $this->channel;
285  }
286 
293  public function getValidFrom()
294  {
295  return $this->validFrom;
296  }
297 
304  public function getValidUntil()
305  {
306  return $this->validUntil;
307  }
308 
316  public function getTiers()
317  {
318  return $this->tiers;
319  }
320 
328  public function getDiscounted()
329  {
330  return $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted;
331  }
332 
339  public function getCustom()
340  {
341  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
342  }
343 
350  public function getStaged()
351  {
352  return $this->staged instanceof StagedStandalonePriceBuilder ? $this->staged->build() : $this->staged;
353  }
354 
362  public function getActive()
363  {
364  return $this->active;
365  }
366 
371  public function withId(?string $id)
372  {
373  $this->id = $id;
374 
375  return $this;
376  }
377 
382  public function withVersion(?int $version)
383  {
384  $this->version = $version;
385 
386  return $this;
387  }
388 
393  public function withCreatedAt(?DateTimeImmutable $createdAt)
394  {
395  $this->createdAt = $createdAt;
396 
397  return $this;
398  }
399 
404  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
405  {
406  $this->lastModifiedAt = $lastModifiedAt;
407 
408  return $this;
409  }
410 
415  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
416  {
417  $this->lastModifiedBy = $lastModifiedBy;
418 
419  return $this;
420  }
421 
426  public function withCreatedBy(?CreatedBy $createdBy)
427  {
428  $this->createdBy = $createdBy;
429 
430  return $this;
431  }
432 
437  public function withKey(?string $key)
438  {
439  $this->key = $key;
440 
441  return $this;
442  }
443 
448  public function withSku(?string $sku)
449  {
450  $this->sku = $sku;
451 
452  return $this;
453  }
454 
459  public function withValue(?TypedMoney $value)
460  {
461  $this->value = $value;
462 
463  return $this;
464  }
465 
470  public function withCountry(?string $country)
471  {
472  $this->country = $country;
473 
474  return $this;
475  }
476 
481  public function withCustomerGroup(?CustomerGroupReference $customerGroup)
482  {
483  $this->customerGroup = $customerGroup;
484 
485  return $this;
486  }
487 
492  public function withChannel(?ChannelReference $channel)
493  {
494  $this->channel = $channel;
495 
496  return $this;
497  }
498 
503  public function withValidFrom(?DateTimeImmutable $validFrom)
504  {
505  $this->validFrom = $validFrom;
506 
507  return $this;
508  }
509 
514  public function withValidUntil(?DateTimeImmutable $validUntil)
515  {
516  $this->validUntil = $validUntil;
517 
518  return $this;
519  }
520 
525  public function withTiers(?PriceTierCollection $tiers)
526  {
527  $this->tiers = $tiers;
528 
529  return $this;
530  }
531 
536  public function withDiscounted(?DiscountedPrice $discounted)
537  {
538  $this->discounted = $discounted;
539 
540  return $this;
541  }
542 
547  public function withCustom(?CustomFields $custom)
548  {
549  $this->custom = $custom;
550 
551  return $this;
552  }
553 
558  public function withStaged(?StagedStandalonePrice $staged)
559  {
560  $this->staged = $staged;
561 
562  return $this;
563  }
564 
569  public function withActive(?bool $active)
570  {
571  $this->active = $active;
572 
573  return $this;
574  }
575 
580  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
581  {
582  $this->lastModifiedBy = $lastModifiedBy;
583 
584  return $this;
585  }
586 
591  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
592  {
593  $this->createdBy = $createdBy;
594 
595  return $this;
596  }
597 
602  public function withValueBuilder(?TypedMoneyBuilder $value)
603  {
604  $this->value = $value;
605 
606  return $this;
607  }
608 
614  {
615  $this->customerGroup = $customerGroup;
616 
617  return $this;
618  }
619 
624  public function withChannelBuilder(?ChannelReferenceBuilder $channel)
625  {
626  $this->channel = $channel;
627 
628  return $this;
629  }
630 
635  public function withDiscountedBuilder(?DiscountedPriceBuilder $discounted)
636  {
637  $this->discounted = $discounted;
638 
639  return $this;
640  }
641 
646  public function withCustomBuilder(?CustomFieldsBuilder $custom)
647  {
648  $this->custom = $custom;
649 
650  return $this;
651  }
652 
658  {
659  $this->staged = $staged;
660 
661  return $this;
662  }
663 
664  public function build(): StandalonePrice
665  {
666  return new StandalonePriceModel(
667  $this->id,
668  $this->version,
669  $this->createdAt,
670  $this->lastModifiedAt,
671  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
672  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
673  $this->key,
674  $this->sku,
675  $this->value instanceof TypedMoneyBuilder ? $this->value->build() : $this->value,
676  $this->country,
677  $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
678  $this->channel instanceof ChannelReferenceBuilder ? $this->channel->build() : $this->channel,
679  $this->validFrom,
680  $this->validUntil,
681  $this->tiers,
682  $this->discounted instanceof DiscountedPriceBuilder ? $this->discounted->build() : $this->discounted,
683  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
684  $this->staged instanceof StagedStandalonePriceBuilder ? $this->staged->build() : $this->staged,
685  $this->active
686  );
687  }
688 
689  public static function of(): StandalonePriceBuilder
690  {
691  return new self();
692  }
693 }
withCustomerGroupBuilder(?CustomerGroupReferenceBuilder $customerGroup)