commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SetParcelItemsChangeBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
20 
24 final class SetParcelItemsChangeBuilder implements Builder
25 {
30  private $change;
31 
36  private $previousValue;
37 
42  private $nextValue;
43 
48  private $parcel;
49 
54  public function getChange()
55  {
56  return $this->change;
57  }
58 
65  public function getPreviousValue()
66  {
67  return $this->previousValue;
68  }
69 
76  public function getNextValue()
77  {
78  return $this->nextValue;
79  }
80 
87  public function getParcel()
88  {
89  return $this->parcel instanceof ParcelChangeValueBuilder ? $this->parcel->build() : $this->parcel;
90  }
91 
96  public function withChange(?string $change)
97  {
98  $this->change = $change;
99 
100  return $this;
101  }
102 
107  public function withPreviousValue(?DeliveryItemCollection $previousValue)
108  {
109  $this->previousValue = $previousValue;
110 
111  return $this;
112  }
113 
118  public function withNextValue(?DeliveryItemCollection $nextValue)
119  {
120  $this->nextValue = $nextValue;
121 
122  return $this;
123  }
124 
129  public function withParcel(?ParcelChangeValue $parcel)
130  {
131  $this->parcel = $parcel;
132 
133  return $this;
134  }
135 
140  public function withParcelBuilder(?ParcelChangeValueBuilder $parcel)
141  {
142  $this->parcel = $parcel;
143 
144  return $this;
145  }
146 
147  public function build(): SetParcelItemsChange
148  {
149  return new SetParcelItemsChangeModel(
150  $this->change,
151  $this->previousValue,
152  $this->nextValue,
153  $this->parcel instanceof ParcelChangeValueBuilder ? $this->parcel->build() : $this->parcel
154  );
155  }
156 
157  public static function of(): SetParcelItemsChangeBuilder
158  {
159  return new self();
160  }
161 }