commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
PriceDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
24use DateTimeImmutable;
25use stdClass;
26
30final class PriceDraftBuilder implements Builder
31{
36 private $key;
37
42 private $value;
43
48 private $country;
49
54 private $customerGroup;
55
60 private $channel;
61
66 private $validFrom;
67
72 private $validUntil;
73
78 private $discounted;
79
84 private $tiers;
85
90 private $custom;
91
96 private $recurrencePolicy;
97
104 public function getKey()
105 {
106 return $this->key;
107 }
108
116 public function getValue()
117 {
118 return $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value;
119 }
120
127 public function getCountry()
128 {
129 return $this->country;
130 }
131
138 public function getCustomerGroup()
139 {
140 return $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup;
141 }
142
149 public function getChannel()
150 {
151 return $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel;
152 }
153
160 public function getValidFrom()
161 {
162 return $this->validFrom;
163 }
164
171 public function getValidUntil()
172 {
173 return $this->validUntil;
174 }
175
189 public function getDiscounted()
190 {
191 return $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted;
192 }
193
201 public function getTiers()
202 {
203 return $this->tiers;
204 }
205
212 public function getCustom()
213 {
214 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
215 }
216
223 public function getRecurrencePolicy()
224 {
225 return $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy;
226 }
227
232 public function withKey(?string $key)
233 {
234 $this->key = $key;
235
236 return $this;
237 }
238
243 public function withValue(?Money $value)
244 {
245 $this->value = $value;
246
247 return $this;
248 }
249
254 public function withCountry(?string $country)
255 {
256 $this->country = $country;
257
258 return $this;
259 }
260
265 public function withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
266 {
267 $this->customerGroup = $customerGroup;
268
269 return $this;
270 }
271
276 public function withChannel(?ChannelResourceIdentifier $channel)
277 {
278 $this->channel = $channel;
279
280 return $this;
281 }
282
287 public function withValidFrom(?DateTimeImmutable $validFrom)
288 {
289 $this->validFrom = $validFrom;
290
291 return $this;
292 }
293
298 public function withValidUntil(?DateTimeImmutable $validUntil)
299 {
300 $this->validUntil = $validUntil;
301
302 return $this;
303 }
304
309 public function withDiscounted(?DiscountedPriceDraft $discounted)
310 {
311 $this->discounted = $discounted;
312
313 return $this;
314 }
315
320 public function withTiers(?PriceTierDraftCollection $tiers)
321 {
322 $this->tiers = $tiers;
323
324 return $this;
325 }
326
331 public function withCustom(?CustomFieldsDraft $custom)
332 {
333 $this->custom = $custom;
334
335 return $this;
336 }
337
343 {
344 $this->recurrencePolicy = $recurrencePolicy;
345
346 return $this;
347 }
348
353 public function withValueBuilder(?MoneyBuilder $value)
354 {
355 $this->value = $value;
356
357 return $this;
358 }
359
365 {
366 $this->customerGroup = $customerGroup;
367
368 return $this;
369 }
370
376 {
377 $this->channel = $channel;
378
379 return $this;
380 }
381
387 {
388 $this->discounted = $discounted;
389
390 return $this;
391 }
392
398 {
399 $this->custom = $custom;
400
401 return $this;
402 }
403
409 {
410 $this->recurrencePolicy = $recurrencePolicy;
411
412 return $this;
413 }
414
415 public function build(): PriceDraft
416 {
417 return new PriceDraftModel(
418 $this->key,
419 $this->value instanceof MoneyBuilder ? $this->value->build() : $this->value,
420 $this->country,
421 $this->customerGroup instanceof CustomerGroupResourceIdentifierBuilder ? $this->customerGroup->build() : $this->customerGroup,
422 $this->channel instanceof ChannelResourceIdentifierBuilder ? $this->channel->build() : $this->channel,
423 $this->validFrom,
424 $this->validUntil,
425 $this->discounted instanceof DiscountedPriceDraftBuilder ? $this->discounted->build() : $this->discounted,
426 $this->tiers,
427 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
428 $this->recurrencePolicy instanceof RecurrencePolicyResourceIdentifierBuilder ? $this->recurrencePolicy->build() : $this->recurrencePolicy
429 );
430 }
431
432 public static function of(): PriceDraftBuilder
433 {
434 return new self();
435 }
436}
withRecurrencePolicy(?RecurrencePolicyResourceIdentifier $recurrencePolicy)
withRecurrencePolicyBuilder(?RecurrencePolicyResourceIdentifierBuilder $recurrencePolicy)
withDiscounted(?DiscountedPriceDraft $discounted)
withCustomerGroupBuilder(?CustomerGroupResourceIdentifierBuilder $customerGroup)
withChannel(?ChannelResourceIdentifier $channel)
withChannelBuilder(?ChannelResourceIdentifierBuilder $channel)
withCustomerGroup(?CustomerGroupResourceIdentifier $customerGroup)
withDiscountedBuilder(?DiscountedPriceDraftBuilder $discounted)
withCustomBuilder(?CustomFieldsDraftBuilder $custom)