commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ShippingMethodBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
28 use DateTimeImmutable;
29 use stdClass;
30 
34 final class ShippingMethodBuilder implements Builder
35 {
40  private $id;
41 
46  private $version;
47 
52  private $createdAt;
53 
58  private $lastModifiedAt;
59 
64  private $lastModifiedBy;
65 
70  private $createdBy;
71 
76  private $key;
77 
82  private $name;
83 
88  private $localizedName;
89 
94  private $description;
95 
100  private $localizedDescription;
101 
106  private $taxCategory;
107 
112  private $zoneRates;
113 
118  private $active;
119 
124  private $isDefault;
125 
130  private $predicate;
131 
136  private $custom;
137 
144  public function getId()
145  {
146  return $this->id;
147  }
148 
155  public function getVersion()
156  {
157  return $this->version;
158  }
159 
166  public function getCreatedAt()
167  {
168  return $this->createdAt;
169  }
170 
177  public function getLastModifiedAt()
178  {
179  return $this->lastModifiedAt;
180  }
181 
188  public function getLastModifiedBy()
189  {
190  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
191  }
192 
199  public function getCreatedBy()
200  {
201  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
202  }
203 
210  public function getKey()
211  {
212  return $this->key;
213  }
214 
221  public function getName()
222  {
223  return $this->name;
224  }
225 
232  public function getLocalizedName()
233  {
234  return $this->localizedName instanceof LocalizedStringBuilder ? $this->localizedName->build() : $this->localizedName;
235  }
236 
243  public function getDescription()
244  {
245  return $this->description;
246  }
247 
254  public function getLocalizedDescription()
255  {
256  return $this->localizedDescription instanceof LocalizedStringBuilder ? $this->localizedDescription->build() : $this->localizedDescription;
257  }
258 
265  public function getTaxCategory()
266  {
267  return $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory;
268  }
269 
276  public function getZoneRates()
277  {
278  return $this->zoneRates;
279  }
280 
288  public function getActive()
289  {
290  return $this->active;
291  }
292 
299  public function getIsDefault()
300  {
301  return $this->isDefault;
302  }
303 
310  public function getPredicate()
311  {
312  return $this->predicate;
313  }
314 
321  public function getCustom()
322  {
323  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
324  }
325 
330  public function withId(?string $id)
331  {
332  $this->id = $id;
333 
334  return $this;
335  }
336 
341  public function withVersion(?int $version)
342  {
343  $this->version = $version;
344 
345  return $this;
346  }
347 
352  public function withCreatedAt(?DateTimeImmutable $createdAt)
353  {
354  $this->createdAt = $createdAt;
355 
356  return $this;
357  }
358 
363  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
364  {
365  $this->lastModifiedAt = $lastModifiedAt;
366 
367  return $this;
368  }
369 
374  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
375  {
376  $this->lastModifiedBy = $lastModifiedBy;
377 
378  return $this;
379  }
380 
385  public function withCreatedBy(?CreatedBy $createdBy)
386  {
387  $this->createdBy = $createdBy;
388 
389  return $this;
390  }
391 
396  public function withKey(?string $key)
397  {
398  $this->key = $key;
399 
400  return $this;
401  }
402 
407  public function withName(?string $name)
408  {
409  $this->name = $name;
410 
411  return $this;
412  }
413 
418  public function withLocalizedName(?LocalizedString $localizedName)
419  {
420  $this->localizedName = $localizedName;
421 
422  return $this;
423  }
424 
429  public function withDescription(?string $description)
430  {
431  $this->description = $description;
432 
433  return $this;
434  }
435 
440  public function withLocalizedDescription(?LocalizedString $localizedDescription)
441  {
442  $this->localizedDescription = $localizedDescription;
443 
444  return $this;
445  }
446 
451  public function withTaxCategory(?TaxCategoryReference $taxCategory)
452  {
453  $this->taxCategory = $taxCategory;
454 
455  return $this;
456  }
457 
462  public function withZoneRates(?ZoneRateCollection $zoneRates)
463  {
464  $this->zoneRates = $zoneRates;
465 
466  return $this;
467  }
468 
473  public function withActive(?bool $active)
474  {
475  $this->active = $active;
476 
477  return $this;
478  }
479 
484  public function withIsDefault(?bool $isDefault)
485  {
486  $this->isDefault = $isDefault;
487 
488  return $this;
489  }
490 
495  public function withPredicate(?string $predicate)
496  {
497  $this->predicate = $predicate;
498 
499  return $this;
500  }
501 
506  public function withCustom(?CustomFields $custom)
507  {
508  $this->custom = $custom;
509 
510  return $this;
511  }
512 
517  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
518  {
519  $this->lastModifiedBy = $lastModifiedBy;
520 
521  return $this;
522  }
523 
528  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
529  {
530  $this->createdBy = $createdBy;
531 
532  return $this;
533  }
534 
539  public function withLocalizedNameBuilder(?LocalizedStringBuilder $localizedName)
540  {
541  $this->localizedName = $localizedName;
542 
543  return $this;
544  }
545 
550  public function withLocalizedDescriptionBuilder(?LocalizedStringBuilder $localizedDescription)
551  {
552  $this->localizedDescription = $localizedDescription;
553 
554  return $this;
555  }
556 
562  {
563  $this->taxCategory = $taxCategory;
564 
565  return $this;
566  }
567 
572  public function withCustomBuilder(?CustomFieldsBuilder $custom)
573  {
574  $this->custom = $custom;
575 
576  return $this;
577  }
578 
579  public function build(): ShippingMethod
580  {
581  return new ShippingMethodModel(
582  $this->id,
583  $this->version,
584  $this->createdAt,
585  $this->lastModifiedAt,
586  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
587  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
588  $this->key,
589  $this->name,
590  $this->localizedName instanceof LocalizedStringBuilder ? $this->localizedName->build() : $this->localizedName,
591  $this->description,
592  $this->localizedDescription instanceof LocalizedStringBuilder ? $this->localizedDescription->build() : $this->localizedDescription,
593  $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
594  $this->zoneRates,
595  $this->active,
596  $this->isDefault,
597  $this->predicate,
598  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
599  );
600  }
601 
602  public static function of(): ShippingMethodBuilder
603  {
604  return new self();
605  }
606 }
withLocalizedDescriptionBuilder(?LocalizedStringBuilder $localizedDescription)
withTaxCategoryBuilder(?TaxCategoryReferenceBuilder $taxCategory)