commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
StandalonePriceDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
29use DateTimeImmutable;
30use stdClass;
31
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
107 private $recurrencePolicy;
108
113 private $staged;
114
119 private $active;
120
128 public function getKey()
129 {
130 return $this->key;
131 }
132
140 public function getSku()
141 {
142 return $this->sku;
143 }
144
152 public function getValue()
153 {
154 return $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value;
155 }
156
163 public function getCountry()
164 {
165 return $this->country;
166 }
167
174 public function getCustomerGroup()
175 {
176 return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
177 }
178
186 public function getChannel()
187 {
188 return $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel;
189 }
190
197 public function getValidFrom()
198 {
199 return $this->validFrom;
200 }
201
208 public function getValidUntil()
209 {
210 return $this->validUntil;
211 }
212
220 public function getTiers()
221 {
222 return $this->tiers;
223 }
224
231 public function getDiscounted()
232 {
233 return $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted;
234 }
235
242 public function getCustom()
243 {
244 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
245 }
246
253 public function getRecurrencePolicy()
254 {
255 return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy;
256 }
257
264 public function getStaged()
265 {
266 return $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged;
267 }
268
275 public function getActive()
276 {
277 return $this->active;
278 }
279
284 public function withKey(?string $key)
285 {
286 $this->key = $key;
287
288 return $this;
289 }
290
295 public function withSku(?string $sku)
296 {
297 $this->sku = $sku;
298
299 return $this;
300 }
301
306 public function withValue(?Money $value)
307 {
308 $this->value = $value;
309
310 return $this;
311 }
312
317 public function withCountry(?string $country)
318 {
319 $this->country = $country;
320
321 return $this;
322 }
323
328 public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
329 {
330 $this->customerGroup = $customerGroup;
331
332 return $this;
333 }
334
339 public function withChannel(?ChannelResourceIdentifier $channel)
340 {
341 $this->channel = $channel;
342
343 return $this;
344 }
345
350 public function withValidFrom(?DateTimeImmutable $validFrom)
351 {
352 $this->validFrom = $validFrom;
353
354 return $this;
355 }
356
361 public function withValidUntil(?DateTimeImmutable $validUntil)
362 {
363 $this->validUntil = $validUntil;
364
365 return $this;
366 }
367
372 public function withTiers(?PriceTierDraftCollection $tiers)
373 {
374 $this->tiers = $tiers;
375
376 return $this;
377 }
378
383 public function withDiscounted(?DiscountedPriceDraft $discounted)
384 {
385 $this->discounted = $discounted;
386
387 return $this;
388 }
389
394 public function withCustom(?CustomFieldsDraft $custom)
395 {
396 $this->custom = $custom;
397
398 return $this;
399 }
400
406 {
407 $this->recurrencePolicy = $recurrencePolicy;
408
409 return $this;
410 }
411
416 public function withStaged(?StagedPriceDraft $staged)
417 {
418 $this->staged = $staged;
419
420 return $this;
421 }
422
427 public function withActive(?bool $active)
428 {
429 $this->active = $active;
430
431 return $this;
432 }
433
438 public function withValueBuilder(?MoneyBuilder $value)
439 {
440 $this->value = $value;
441
442 return $this;
443 }
444
450 {
451 $this->customerGroup = $customerGroup;
452
453 return $this;
454 }
455
461 {
462 $this->channel = $channel;
463
464 return $this;
465 }
466
472 {
473 $this->discounted = $discounted;
474
475 return $this;
476 }
477
483 {
484 $this->custom = $custom;
485
486 return $this;
487 }
488
494 {
495 $this->recurrencePolicy = $recurrencePolicy;
496
497 return $this;
498 }
499
505 {
506 $this->staged = $staged;
507
508 return $this;
509 }
510
511 public function build(): StandalonePriceDraft
512 {
513 return new StandalonePriceDraftModel(
514 $this->key,
515 $this->sku,
516 $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value,
517 $this->country,
518 $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
519 $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel,
520 $this->validFrom,
521 $this->validUntil,
522 $this->tiers,
523 $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted,
524 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
525 $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy,
526 $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged,
527 $this->active
528 );
529 }
530
531 public static function of(): StandalonePriceDraftBuilder
532 {
533 return new self();
534 }
535}
withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup)
withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy)
withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy)