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
27use DateTimeImmutable;
28use stdClass;
29
34{
39 private $key;
40
45 private $sku;
46
51 private $value;
52
57 private $country;
58
63 private $customerGroup;
64
69 private $channel;
70
75 private $validFrom;
76
81 private $validUntil;
82
87 private $tiers;
88
93 private $discounted;
94
99 private $custom;
100
105 private $staged;
106
111 private $active;
112
119 public function getKey()
120 {
121 return $this->key;
122 }
123
131 public function getSku()
132 {
133 return $this->sku;
134 }
135
143 public function getValue()
144 {
145 return $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value;
146 }
147
154 public function getCountry()
155 {
156 return $this->country;
157 }
158
165 public function getCustomerGroup()
166 {
167 return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
168 }
169
176 public function getChannel()
177 {
178 return $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel;
179 }
180
187 public function getValidFrom()
188 {
189 return $this->validFrom;
190 }
191
198 public function getValidUntil()
199 {
200 return $this->validUntil;
201 }
202
210 public function getTiers()
211 {
212 return $this->tiers;
213 }
214
221 public function getDiscounted()
222 {
223 return $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted;
224 }
225
232 public function getCustom()
233 {
234 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
235 }
236
243 public function getStaged()
244 {
245 return $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged;
246 }
247
254 public function getActive()
255 {
256 return $this->active;
257 }
258
263 public function withKey(?string $key)
264 {
265 $this->key = $key;
266
267 return $this;
268 }
269
274 public function withSku(?string $sku)
275 {
276 $this->sku = $sku;
277
278 return $this;
279 }
280
285 public function withValue(?Money $value)
286 {
287 $this->value = $value;
288
289 return $this;
290 }
291
296 public function withCountry(?string $country)
297 {
298 $this->country = $country;
299
300 return $this;
301 }
302
307 public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
308 {
309 $this->customerGroup = $customerGroup;
310
311 return $this;
312 }
313
318 public function withChannel(?ChannelResourceIdentifier $channel)
319 {
320 $this->channel = $channel;
321
322 return $this;
323 }
324
329 public function withValidFrom(?DateTimeImmutable $validFrom)
330 {
331 $this->validFrom = $validFrom;
332
333 return $this;
334 }
335
340 public function withValidUntil(?DateTimeImmutable $validUntil)
341 {
342 $this->validUntil = $validUntil;
343
344 return $this;
345 }
346
351 public function withTiers(?PriceTierDraftCollection $tiers)
352 {
353 $this->tiers = $tiers;
354
355 return $this;
356 }
357
362 public function withDiscounted(?DiscountedPriceDraft $discounted)
363 {
364 $this->discounted = $discounted;
365
366 return $this;
367 }
368
373 public function withCustom(?CustomFieldsDraft $custom)
374 {
375 $this->custom = $custom;
376
377 return $this;
378 }
379
384 public function withStaged(?StagedPriceDraft $staged)
385 {
386 $this->staged = $staged;
387
388 return $this;
389 }
390
395 public function withActive(?bool $active)
396 {
397 $this->active = $active;
398
399 return $this;
400 }
401
406 public function withValueBuilder(?MoneyBuilder $value)
407 {
408 $this->value = $value;
409
410 return $this;
411 }
412
418 {
419 $this->customerGroup = $customerGroup;
420
421 return $this;
422 }
423
429 {
430 $this->channel = $channel;
431
432 return $this;
433 }
434
440 {
441 $this->discounted = $discounted;
442
443 return $this;
444 }
445
451 {
452 $this->custom = $custom;
453
454 return $this;
455 }
456
462 {
463 $this->staged = $staged;
464
465 return $this;
466 }
467
468 public function build(): StandalonePriceDraft
469 {
470 return new StandalonePriceDraftModel(
471 $this->key,
472 $this->sku,
473 $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value,
474 $this->country,
475 $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
476 $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel,
477 $this->validFrom,
478 $this->validUntil,
479 $this->tiers,
480 $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted,
481 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
482 $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged,
483 $this->active
484 );
485 }
486
487 public static function of(): StandalonePriceDraftBuilder
488 {
489 return new self();
490 }
491}
withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup)