commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
QuoteRequestDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use stdClass;
23 
27 final class QuoteRequestDraftBuilder implements Builder
28 {
33  private $cart;
34 
39  private $cartVersion;
40 
45  private $key;
46 
51  private $comment;
52 
57  private $custom;
58 
63  private $state;
64 
69  private $purchaseOrderNumber;
70 
79  public function getCart()
80  {
81  return $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart;
82  }
83 
90  public function getCartVersion()
91  {
92  return $this->cartVersion;
93  }
94 
101  public function getKey()
102  {
103  return $this->key;
104  }
105 
112  public function getComment()
113  {
114  return $this->comment;
115  }
116 
123  public function getCustom()
124  {
125  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
126  }
127 
135  public function getState()
136  {
137  return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state;
138  }
139 
147  public function getPurchaseOrderNumber()
148  {
149  return $this->purchaseOrderNumber;
150  }
151 
156  public function withCart(?CartResourceIdentifier $cart)
157  {
158  $this->cart = $cart;
159 
160  return $this;
161  }
162 
167  public function withCartVersion(?int $cartVersion)
168  {
169  $this->cartVersion = $cartVersion;
170 
171  return $this;
172  }
173 
178  public function withKey(?string $key)
179  {
180  $this->key = $key;
181 
182  return $this;
183  }
184 
189  public function withComment(?string $comment)
190  {
191  $this->comment = $comment;
192 
193  return $this;
194  }
195 
200  public function withCustom(?CustomFieldsDraft $custom)
201  {
202  $this->custom = $custom;
203 
204  return $this;
205  }
206 
211  public function withState(?StateReference $state)
212  {
213  $this->state = $state;
214 
215  return $this;
216  }
217 
222  public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
223  {
224  $this->purchaseOrderNumber = $purchaseOrderNumber;
225 
226  return $this;
227  }
228 
234  {
235  $this->cart = $cart;
236 
237  return $this;
238  }
239 
244  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
245  {
246  $this->custom = $custom;
247 
248  return $this;
249  }
250 
255  public function withStateBuilder(?StateReferenceBuilder $state)
256  {
257  $this->state = $state;
258 
259  return $this;
260  }
261 
262  public function build(): QuoteRequestDraft
263  {
264  return new QuoteRequestDraftModel(
265  $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart,
266  $this->cartVersion,
267  $this->key,
268  $this->comment,
269  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
270  $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
271  $this->purchaseOrderNumber
272  );
273  }
274 
275  public static function of(): QuoteRequestDraftBuilder
276  {
277  return new self();
278  }
279 }