commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
QuoteRequestDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use stdClass;
23
27final 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
148 public function getPurchaseOrderNumber()
149 {
150 return $this->purchaseOrderNumber;
151 }
152
157 public function withCart(?CartResourceIdentifier $cart)
158 {
159 $this->cart = $cart;
160
161 return $this;
162 }
163
168 public function withCartVersion(?int $cartVersion)
169 {
170 $this->cartVersion = $cartVersion;
171
172 return $this;
173 }
174
179 public function withKey(?string $key)
180 {
181 $this->key = $key;
182
183 return $this;
184 }
185
190 public function withComment(?string $comment)
191 {
192 $this->comment = $comment;
193
194 return $this;
195 }
196
201 public function withCustom(?CustomFieldsDraft $custom)
202 {
203 $this->custom = $custom;
204
205 return $this;
206 }
207
212 public function withState(?StateReference $state)
213 {
214 $this->state = $state;
215
216 return $this;
217 }
218
223 public function withPurchaseOrderNumber(?string $purchaseOrderNumber)
224 {
225 $this->purchaseOrderNumber = $purchaseOrderNumber;
226
227 return $this;
228 }
229
235 {
236 $this->cart = $cart;
237
238 return $this;
239 }
240
246 {
247 $this->custom = $custom;
248
249 return $this;
250 }
251
257 {
258 $this->state = $state;
259
260 return $this;
261 }
262
263 public function build(): QuoteRequestDraft
264 {
265 return new QuoteRequestDraftModel(
266 $this->cart instanceof CartResourceIdentifierBuilder ? $this->cart->build() : $this->cart,
267 $this->cartVersion,
268 $this->key,
269 $this->comment,
270 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
271 $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
272 $this->purchaseOrderNumber
273 );
274 }
275
276 public static function of(): QuoteRequestDraftBuilder
277 {
278 return new self();
279 }
280}