commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
OrderEditDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
21 use stdClass;
22 
26 final class OrderEditDraftBuilder implements Builder
27 {
32  private $key;
33 
38  private $resource;
39 
44  private $stagedActions;
45 
50  private $custom;
51 
56  private $comment;
57 
62  private $dryRun;
63 
70  public function getKey()
71  {
72  return $this->key;
73  }
74 
81  public function getResource()
82  {
83  return $this->resource instanceof OrderReferenceBuilder ? $this->resource->build() : $this->resource;
84  }
85 
93  public function getStagedActions()
94  {
95  return $this->stagedActions;
96  }
97 
104  public function getCustom()
105  {
106  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
107  }
108 
115  public function getComment()
116  {
117  return $this->comment;
118  }
119 
128  public function getDryRun()
129  {
130  return $this->dryRun;
131  }
132 
137  public function withKey(?string $key)
138  {
139  $this->key = $key;
140 
141  return $this;
142  }
143 
148  public function withResource(?OrderReference $resource)
149  {
150  $this->resource = $resource;
151 
152  return $this;
153  }
154 
159  public function withStagedActions(?StagedOrderUpdateActionCollection $stagedActions)
160  {
161  $this->stagedActions = $stagedActions;
162 
163  return $this;
164  }
165 
170  public function withCustom(?CustomFieldsDraft $custom)
171  {
172  $this->custom = $custom;
173 
174  return $this;
175  }
176 
181  public function withComment(?string $comment)
182  {
183  $this->comment = $comment;
184 
185  return $this;
186  }
187 
192  public function withDryRun(?bool $dryRun)
193  {
194  $this->dryRun = $dryRun;
195 
196  return $this;
197  }
198 
203  public function withResourceBuilder(?OrderReferenceBuilder $resource)
204  {
205  $this->resource = $resource;
206 
207  return $this;
208  }
209 
214  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
215  {
216  $this->custom = $custom;
217 
218  return $this;
219  }
220 
221  public function build(): OrderEditDraft
222  {
223  return new OrderEditDraftModel(
224  $this->key,
225  $this->resource instanceof OrderReferenceBuilder ? $this->resource->build() : $this->resource,
226  $this->stagedActions,
227  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
228  $this->comment,
229  $this->dryRun
230  );
231  }
232 
233  public static function of(): OrderEditDraftBuilder
234  {
235  return new self();
236  }
237 }
withStagedActions(?StagedOrderUpdateActionCollection $stagedActions)