commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DeliveryParcelDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
21 use stdClass;
22 
26 final class DeliveryParcelDraftBuilder implements Builder
27 {
32  private $measurements;
33 
38  private $trackingData;
39 
44  private $items;
45 
50  public function getMeasurements()
51  {
52  return $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements;
53  }
54 
59  public function getTrackingData()
60  {
61  return $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData;
62  }
63 
68  public function getItems()
69  {
70  return $this->items;
71  }
72 
77  public function withMeasurements(?ParcelMeasurements $measurements)
78  {
79  $this->measurements = $measurements;
80 
81  return $this;
82  }
83 
88  public function withTrackingData(?TrackingData $trackingData)
89  {
90  $this->trackingData = $trackingData;
91 
92  return $this;
93  }
94 
99  public function withItems(?DeliveryItemCollection $items)
100  {
101  $this->items = $items;
102 
103  return $this;
104  }
105 
110  public function withMeasurementsBuilder(?ParcelMeasurementsBuilder $measurements)
111  {
112  $this->measurements = $measurements;
113 
114  return $this;
115  }
116 
121  public function withTrackingDataBuilder(?TrackingDataBuilder $trackingData)
122  {
123  $this->trackingData = $trackingData;
124 
125  return $this;
126  }
127 
128  public function build(): DeliveryParcelDraft
129  {
130  return new DeliveryParcelDraftModel(
131  $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements,
132  $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData,
133  $this->items
134  );
135  }
136 
137  public static function of(): DeliveryParcelDraftBuilder
138  {
139  return new self();
140  }
141 }