commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MyLineItemDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
24use DateTimeImmutable;
25use stdClass;
26
30final class MyLineItemDraftBuilder implements Builder
31{
36 private $key;
37
42 private $productId;
43
48 private $variantId;
49
54 private $sku;
55
60 private $quantity;
61
66 private $addedAt;
67
72 private $supplyChannel;
73
78 private $distributionChannel;
79
84 private $shippingDetails;
85
90 private $recurrenceInfo;
91
96 private $custom;
97
104 public function getKey()
105 {
106 return $this->key;
107 }
108
115 public function getProductId()
116 {
117 return $this->productId;
118 }
119
127 public function getVariantId()
128 {
129 return $this->variantId;
130 }
131
138 public function getSku()
139 {
140 return $this->sku;
141 }
142
149 public function getQuantity()
150 {
151 return $this->quantity;
152 }
153
162 public function getAddedAt()
163 {
164 return $this->addedAt;
165 }
166
174 public function getSupplyChannel()
175 {
176 return $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
177 }
178
188 public function getDistributionChannel()
189 {
190 return $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel;
191 }
192
199 public function getShippingDetails()
200 {
201 return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
202 }
203
210 public function getRecurrenceInfo()
211 {
212 return $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo;
213 }
214
221 public function getCustom()
222 {
223 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
224 }
225
230 public function withKey(?string $key)
231 {
232 $this->key = $key;
233
234 return $this;
235 }
236
241 public function withProductId(?string $productId)
242 {
243 $this->productId = $productId;
244
245 return $this;
246 }
247
252 public function withVariantId(?int $variantId)
253 {
254 $this->variantId = $variantId;
255
256 return $this;
257 }
258
263 public function withSku(?string $sku)
264 {
265 $this->sku = $sku;
266
267 return $this;
268 }
269
274 public function withQuantity(?int $quantity)
275 {
276 $this->quantity = $quantity;
277
278 return $this;
279 }
280
285 public function withAddedAt(?DateTimeImmutable $addedAt)
286 {
287 $this->addedAt = $addedAt;
288
289 return $this;
290 }
291
296 public function withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
297 {
298 $this->supplyChannel = $supplyChannel;
299
300 return $this;
301 }
302
307 public function withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
308 {
309 $this->distributionChannel = $distributionChannel;
310
311 return $this;
312 }
313
318 public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
319 {
320 $this->shippingDetails = $shippingDetails;
321
322 return $this;
323 }
324
329 public function withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo)
330 {
331 $this->recurrenceInfo = $recurrenceInfo;
332
333 return $this;
334 }
335
340 public function withCustom(?CustomFieldsDraft $custom)
341 {
342 $this->custom = $custom;
343
344 return $this;
345 }
346
352 {
353 $this->supplyChannel = $supplyChannel;
354
355 return $this;
356 }
357
363 {
364 $this->distributionChannel = $distributionChannel;
365
366 return $this;
367 }
368
374 {
375 $this->shippingDetails = $shippingDetails;
376
377 return $this;
378 }
379
385 {
386 $this->recurrenceInfo = $recurrenceInfo;
387
388 return $this;
389 }
390
396 {
397 $this->custom = $custom;
398
399 return $this;
400 }
401
402 public function build(): MyLineItemDraft
403 {
404 return new MyLineItemDraftModel(
405 $this->key,
406 $this->productId,
407 $this->variantId,
408 $this->sku,
409 $this->quantity,
410 $this->addedAt,
411 $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
412 $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel,
413 $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails,
414 $this->recurrenceInfo instanceof LineItemRecurrenceInfoDraftBuilder ? $this->recurrenceInfo->build() : $this->recurrenceInfo,
415 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
416 );
417 }
418
419 public static function of(): MyLineItemDraftBuilder
420 {
421 return new self();
422 }
423}
withRecurrenceInfoBuilder(?LineItemRecurrenceInfoDraftBuilder $recurrenceInfo)
withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
withDistributionChannelBuilder(?ChannelResourceIdentifierBuilder $distributionChannel)
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)
withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
withRecurrenceInfo(?LineItemRecurrenceInfoDraft $recurrenceInfo)
withSupplyChannelBuilder(?ChannelResourceIdentifierBuilder $supplyChannel)