commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ParcelTrackingDataBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class ParcelTrackingDataBuilder implements Builder
24{
29 private $parcelId;
30
35 private $trackingData;
36
41 public function getParcelId()
42 {
43 return $this->parcelId;
44 }
45
50 public function getTrackingData()
51 {
52 return $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData;
53 }
54
59 public function withParcelId(?string $parcelId)
60 {
61 $this->parcelId = $parcelId;
62
63 return $this;
64 }
65
70 public function withTrackingData(?TrackingData $trackingData)
71 {
72 $this->trackingData = $trackingData;
73
74 return $this;
75 }
76
81 public function withTrackingDataBuilder(?TrackingDataBuilder $trackingData)
82 {
83 $this->trackingData = $trackingData;
84
85 return $this;
86 }
87
88 public function build(): ParcelTrackingData
89 {
90 return new ParcelTrackingDataModel(
91 $this->parcelId,
92 $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData
93 );
94 }
95
96 public static function of(): ParcelTrackingDataBuilder
97 {
98 return new self();
99 }
100}