commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
StandalonePriceDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
27 use DateTimeImmutable;
28 use stdClass;
29 
33 final class StandalonePriceDraftBuilder implements Builder
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 
142  public function getValue()
143  {
144  return $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value;
145  }
146 
153  public function getCountry()
154  {
155  return $this->country;
156  }
157 
164  public function getCustomerGroup()
165  {
166  return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
167  }
168 
175  public function getChannel()
176  {
177  return $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel;
178  }
179 
186  public function getValidFrom()
187  {
188  return $this->validFrom;
189  }
190 
197  public function getValidUntil()
198  {
199  return $this->validUntil;
200  }
201 
209  public function getTiers()
210  {
211  return $this->tiers;
212  }
213 
220  public function getDiscounted()
221  {
222  return $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted;
223  }
224 
231  public function getCustom()
232  {
233  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
234  }
235 
242  public function getStaged()
243  {
244  return $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged;
245  }
246 
253  public function getActive()
254  {
255  return $this->active;
256  }
257 
262  public function withKey(?string $key)
263  {
264  $this->key = $key;
265 
266  return $this;
267  }
268 
273  public function withSku(?string $sku)
274  {
275  $this->sku = $sku;
276 
277  return $this;
278  }
279 
284  public function withValue(?Money $value)
285  {
286  $this->value = $value;
287 
288  return $this;
289  }
290 
295  public function withCountry(?string $country)
296  {
297  $this->country = $country;
298 
299  return $this;
300  }
301 
306  public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
307  {
308  $this->customerGroup = $customerGroup;
309 
310  return $this;
311  }
312 
317  public function withChannel(?ChannelResourceIdentifier $channel)
318  {
319  $this->channel = $channel;
320 
321  return $this;
322  }
323 
328  public function withValidFrom(?DateTimeImmutable $validFrom)
329  {
330  $this->validFrom = $validFrom;
331 
332  return $this;
333  }
334 
339  public function withValidUntil(?DateTimeImmutable $validUntil)
340  {
341  $this->validUntil = $validUntil;
342 
343  return $this;
344  }
345 
350  public function withTiers(?PriceTierDraftCollection $tiers)
351  {
352  $this->tiers = $tiers;
353 
354  return $this;
355  }
356 
361  public function withDiscounted(?DiscountedPriceDraft $discounted)
362  {
363  $this->discounted = $discounted;
364 
365  return $this;
366  }
367 
372  public function withCustom(?CustomFieldsDraft $custom)
373  {
374  $this->custom = $custom;
375 
376  return $this;
377  }
378 
383  public function withStaged(?StagedPriceDraft $staged)
384  {
385  $this->staged = $staged;
386 
387  return $this;
388  }
389 
394  public function withActive(?bool $active)
395  {
396  $this->active = $active;
397 
398  return $this;
399  }
400 
405  public function withValueBuilder(?MoneyBuilder $value)
406  {
407  $this->value = $value;
408 
409  return $this;
410  }
411 
417  {
418  $this->customerGroup = $customerGroup;
419 
420  return $this;
421  }
422 
428  {
429  $this->channel = $channel;
430 
431  return $this;
432  }
433 
439  {
440  $this->discounted = $discounted;
441 
442  return $this;
443  }
444 
449  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
450  {
451  $this->custom = $custom;
452 
453  return $this;
454  }
455 
460  public function withStagedBuilder(?StagedPriceDraftBuilder $staged)
461  {
462  $this->staged = $staged;
463 
464  return $this;
465  }
466 
467  public function build(): StandalonePriceDraft
468  {
469  return new StandalonePriceDraftModel(
470  $this->key,
471  $this->sku,
472  $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value,
473  $this->country,
474  $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
475  $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel,
476  $this->validFrom,
477  $this->validUntil,
478  $this->tiers,
479  $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted,
480  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
481  $this->staged instanceof StagedPriceDraftBuilder ? $this->staged->build() : $this->staged,
482  $this->active
483  );
484  }
485 
486  public static function of(): StandalonePriceDraftBuilder
487  {
488  return new self();
489  }
490 }
withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup)