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