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
127 public function getKey()
128 {
129 return $this->key;
130 }
131
139 public function getSku()
140 {
141 return $this->sku;
142 }
143
151 public function getValue()
152 {
153 return $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value;
154 }
155
162 public function getCountry()
163 {
164 return $this->country;
165 }
166
173 public function getCustomerGroup()
174 {
175 return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
176 }
177
184 public function getChannel()
185 {
186 return $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel;
187 }
188
195 public function getValidFrom()
196 {
197 return $this->validFrom;
198 }
199
206 public function getValidUntil()
207 {
208 return $this->validUntil;
209 }
210
218 public function getTiers()
219 {
220 return $this->tiers;
221 }
222
229 public function getDiscounted()
230 {
231 return $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted;
232 }
233
240 public function getCustom()
241 {
242 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
243 }
244
251 public function getRecurrencePolicy()
252 {
253 return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy;
254 }
255
262 public function getStaged()
263 {
264 return $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged;
265 }
266
273 public function getActive()
274 {
275 return $this->active;
276 }
277
282 public function withKey(?string $key)
283 {
284 $this->key = $key;
285
286 return $this;
287 }
288
293 public function withSku(?string $sku)
294 {
295 $this->sku = $sku;
296
297 return $this;
298 }
299
304 public function withValue(?Money $value)
305 {
306 $this->value = $value;
307
308 return $this;
309 }
310
315 public function withCountry(?string $country)
316 {
317 $this->country = $country;
318
319 return $this;
320 }
321
326 public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
327 {
328 $this->customerGroup = $customerGroup;
329
330 return $this;
331 }
332
337 public function withChannel(?ChannelResourceIdentifier $channel)
338 {
339 $this->channel = $channel;
340
341 return $this;
342 }
343
348 public function withValidFrom(?DateTimeImmutable $validFrom)
349 {
350 $this->validFrom = $validFrom;
351
352 return $this;
353 }
354
359 public function withValidUntil(?DateTimeImmutable $validUntil)
360 {
361 $this->validUntil = $validUntil;
362
363 return $this;
364 }
365
370 public function withTiers(?PriceTierDraftCollection $tiers)
371 {
372 $this->tiers = $tiers;
373
374 return $this;
375 }
376
381 public function withDiscounted(?DiscountedPriceDraft $discounted)
382 {
383 $this->discounted = $discounted;
384
385 return $this;
386 }
387
392 public function withCustom(?CustomFieldsDraft $custom)
393 {
394 $this->custom = $custom;
395
396 return $this;
397 }
398
404 {
405 $this->recurrencePolicy = $recurrencePolicy;
406
407 return $this;
408 }
409
414 public function withStaged(?StagedPriceDraft $staged)
415 {
416 $this->staged = $staged;
417
418 return $this;
419 }
420
425 public function withActive(?bool $active)
426 {
427 $this->active = $active;
428
429 return $this;
430 }
431
436 public function withValueBuilder(?MoneyBuilder $value)
437 {
438 $this->value = $value;
439
440 return $this;
441 }
442
448 {
449 $this->customerGroup = $customerGroup;
450
451 return $this;
452 }
453
459 {
460 $this->channel = $channel;
461
462 return $this;
463 }
464
470 {
471 $this->discounted = $discounted;
472
473 return $this;
474 }
475
481 {
482 $this->custom = $custom;
483
484 return $this;
485 }
486
492 {
493 $this->recurrencePolicy = $recurrencePolicy;
494
495 return $this;
496 }
497
503 {
504 $this->staged = $staged;
505
506 return $this;
507 }
508
509 public function build(): StandalonePriceDraft
510 {
511 return new StandalonePriceDraftModel(
512 $this->key,
513 $this->sku,
514 $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value,
515 $this->country,
516 $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
517 $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel,
518 $this->validFrom,
519 $this->validUntil,
520 $this->tiers,
521 $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted,
522 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
523 $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy,
524 $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged,
525 $this->active
526 );
527 }
528
529 public static function of(): StandalonePriceDraftBuilder
530 {
531 return new self();
532 }
533}
withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup)
withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy)
withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy)