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
22use DateTimeImmutable;
23use stdClass;
24
28final class MyLineItemDraftBuilder implements Builder
29{
34 private $key;
35
40 private $productId;
41
46 private $variantId;
47
52 private $sku;
53
58 private $quantity;
59
64 private $addedAt;
65
70 private $supplyChannel;
71
76 private $distributionChannel;
77
82 private $shippingDetails;
83
88 private $custom;
89
96 public function getKey()
97 {
98 return $this->key;
99 }
100
107 public function getProductId()
108 {
109 return $this->productId;
110 }
111
119 public function getVariantId()
120 {
121 return $this->variantId;
122 }
123
130 public function getSku()
131 {
132 return $this->sku;
133 }
134
141 public function getQuantity()
142 {
143 return $this->quantity;
144 }
145
154 public function getAddedAt()
155 {
156 return $this->addedAt;
157 }
158
166 public function getSupplyChannel()
167 {
168 return $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
169 }
170
180 public function getDistributionChannel()
181 {
182 return $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel;
183 }
184
191 public function getShippingDetails()
192 {
193 return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
194 }
195
202 public function getCustom()
203 {
204 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
205 }
206
211 public function withKey(?string $key)
212 {
213 $this->key = $key;
214
215 return $this;
216 }
217
222 public function withProductId(?string $productId)
223 {
224 $this->productId = $productId;
225
226 return $this;
227 }
228
233 public function withVariantId(?int $variantId)
234 {
235 $this->variantId = $variantId;
236
237 return $this;
238 }
239
244 public function withSku(?string $sku)
245 {
246 $this->sku = $sku;
247
248 return $this;
249 }
250
255 public function withQuantity(?int $quantity)
256 {
257 $this->quantity = $quantity;
258
259 return $this;
260 }
261
266 public function withAddedAt(?DateTimeImmutable $addedAt)
267 {
268 $this->addedAt = $addedAt;
269
270 return $this;
271 }
272
277 public function withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
278 {
279 $this->supplyChannel = $supplyChannel;
280
281 return $this;
282 }
283
288 public function withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
289 {
290 $this->distributionChannel = $distributionChannel;
291
292 return $this;
293 }
294
299 public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
300 {
301 $this->shippingDetails = $shippingDetails;
302
303 return $this;
304 }
305
310 public function withCustom(?CustomFieldsDraft $custom)
311 {
312 $this->custom = $custom;
313
314 return $this;
315 }
316
322 {
323 $this->supplyChannel = $supplyChannel;
324
325 return $this;
326 }
327
333 {
334 $this->distributionChannel = $distributionChannel;
335
336 return $this;
337 }
338
344 {
345 $this->shippingDetails = $shippingDetails;
346
347 return $this;
348 }
349
355 {
356 $this->custom = $custom;
357
358 return $this;
359 }
360
361 public function build(): MyLineItemDraft
362 {
363 return new MyLineItemDraftModel(
364 $this->key,
365 $this->productId,
366 $this->variantId,
367 $this->sku,
368 $this->quantity,
369 $this->addedAt,
370 $this->supplyChannel instanceof ChannelResourceIdentifierBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
371 $this->distributionChannel instanceof ChannelResourceIdentifierBuilder ? $this->distributionChannel->build() : $this->distributionChannel,
372 $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails,
373 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
374 );
375 }
376
377 public static function of(): MyLineItemDraftBuilder
378 {
379 return new self();
380 }
381}
withDistributionChannel(?ChannelResourceIdentifier $distributionChannel)
withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
withDistributionChannelBuilder(?ChannelResourceIdentifierBuilder $distributionChannel)
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)
withSupplyChannel(?ChannelResourceIdentifier $supplyChannel)
withSupplyChannelBuilder(?ChannelResourceIdentifierBuilder $supplyChannel)