commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ParcelMeasurementsBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class ParcelMeasurementsBuilder implements Builder
22 {
27  private $heightInMillimeter;
28 
33  private $lengthInMillimeter;
34 
39  private $widthInMillimeter;
40 
45  private $weightInGram;
46 
51  public function getHeightInMillimeter()
52  {
53  return $this->heightInMillimeter;
54  }
55 
60  public function getLengthInMillimeter()
61  {
62  return $this->lengthInMillimeter;
63  }
64 
69  public function getWidthInMillimeter()
70  {
71  return $this->widthInMillimeter;
72  }
73 
78  public function getWeightInGram()
79  {
80  return $this->weightInGram;
81  }
82 
87  public function withHeightInMillimeter(?int $heightInMillimeter)
88  {
89  $this->heightInMillimeter = $heightInMillimeter;
90 
91  return $this;
92  }
93 
98  public function withLengthInMillimeter(?int $lengthInMillimeter)
99  {
100  $this->lengthInMillimeter = $lengthInMillimeter;
101 
102  return $this;
103  }
104 
109  public function withWidthInMillimeter(?int $widthInMillimeter)
110  {
111  $this->widthInMillimeter = $widthInMillimeter;
112 
113  return $this;
114  }
115 
120  public function withWeightInGram(?int $weightInGram)
121  {
122  $this->weightInGram = $weightInGram;
123 
124  return $this;
125  }
126 
127 
128  public function build(): ParcelMeasurements
129  {
130  return new ParcelMeasurementsModel(
131  $this->heightInMillimeter,
132  $this->lengthInMillimeter,
133  $this->widthInMillimeter,
134  $this->weightInGram
135  );
136  }
137 
138  public static function of(): ParcelMeasurementsBuilder
139  {
140  return new self();
141  }
142 }