commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
QuoteDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use stdClass;
23
27final class QuoteDraftBuilder implements Builder
28{
33 private $key;
34
39 private $stagedQuote;
40
45 private $stagedQuoteVersion;
46
51 private $stagedQuoteStateToSent;
52
57 private $state;
58
63 private $custom;
64
71 public function getKey()
72 {
73 return $this->key;
74 }
75
82 public function getStagedQuote()
83 {
84 return $this->stagedQuote instanceof StagedQuoteResourceIdentifierBuilder ? $this->stagedQuote->build() : $this->stagedQuote;
85 }
86
93 public function getStagedQuoteVersion()
94 {
95 return $this->stagedQuoteVersion;
96 }
97
105 {
106 return $this->stagedQuoteStateToSent;
107 }
108
116 public function getState()
117 {
118 return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state;
119 }
120
131 public function getCustom()
132 {
133 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
134 }
135
140 public function withKey(?string $key)
141 {
142 $this->key = $key;
143
144 return $this;
145 }
146
151 public function withStagedQuote(?StagedQuoteResourceIdentifier $stagedQuote)
152 {
153 $this->stagedQuote = $stagedQuote;
154
155 return $this;
156 }
157
162 public function withStagedQuoteVersion(?int $stagedQuoteVersion)
163 {
164 $this->stagedQuoteVersion = $stagedQuoteVersion;
165
166 return $this;
167 }
168
173 public function withStagedQuoteStateToSent(?bool $stagedQuoteStateToSent)
174 {
175 $this->stagedQuoteStateToSent = $stagedQuoteStateToSent;
176
177 return $this;
178 }
179
184 public function withState(?StateReference $state)
185 {
186 $this->state = $state;
187
188 return $this;
189 }
190
195 public function withCustom(?CustomFieldsDraft $custom)
196 {
197 $this->custom = $custom;
198
199 return $this;
200 }
201
207 {
208 $this->stagedQuote = $stagedQuote;
209
210 return $this;
211 }
212
218 {
219 $this->state = $state;
220
221 return $this;
222 }
223
229 {
230 $this->custom = $custom;
231
232 return $this;
233 }
234
235 public function build(): QuoteDraft
236 {
237 return new QuoteDraftModel(
238 $this->key,
239 $this->stagedQuote instanceof StagedQuoteResourceIdentifierBuilder ? $this->stagedQuote->build() : $this->stagedQuote,
240 $this->stagedQuoteVersion,
241 $this->stagedQuoteStateToSent,
242 $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
243 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
244 );
245 }
246
247 public static function of(): QuoteDraftBuilder
248 {
249 return new self();
250 }
251}
withStagedQuote(?StagedQuoteResourceIdentifier $stagedQuote)
withStagedQuoteStateToSent(?bool $stagedQuoteStateToSent)
withCustomBuilder(?CustomFieldsDraftBuilder $custom)
withStagedQuoteBuilder(?StagedQuoteResourceIdentifierBuilder $stagedQuote)