commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ShippingMethodDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use stdClass;
23 
27 final class ShippingMethodDraftBuilder implements Builder
28 {
33  private $key;
34 
39  private $name;
40 
45  private $localizedName;
46 
51  private $description;
52 
57  private $localizedDescription;
58 
63  private $taxCategory;
64 
69  private $zoneRates;
70 
75  private $active;
76 
81  private $isDefault;
82 
87  private $predicate;
88 
93  private $custom;
94 
101  public function getKey()
102  {
103  return $this->key;
104  }
105 
112  public function getName()
113  {
114  return $this->name;
115  }
116 
123  public function getLocalizedName()
124  {
125  return $this->localizedName instanceof LocalizedStringBuilder ? $this->localizedName->build() : $this->localizedName;
126  }
127 
134  public function getDescription()
135  {
136  return $this->description;
137  }
138 
145  public function getLocalizedDescription()
146  {
147  return $this->localizedDescription instanceof LocalizedStringBuilder ? $this->localizedDescription->build() : $this->localizedDescription;
148  }
149 
156  public function getTaxCategory()
157  {
158  return $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory;
159  }
160 
167  public function getZoneRates()
168  {
169  return $this->zoneRates;
170  }
171 
178  public function getActive()
179  {
180  return $this->active;
181  }
182 
189  public function getIsDefault()
190  {
191  return $this->isDefault;
192  }
193 
200  public function getPredicate()
201  {
202  return $this->predicate;
203  }
204 
211  public function getCustom()
212  {
213  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
214  }
215 
220  public function withKey(?string $key)
221  {
222  $this->key = $key;
223 
224  return $this;
225  }
226 
231  public function withName(?string $name)
232  {
233  $this->name = $name;
234 
235  return $this;
236  }
237 
242  public function withLocalizedName(?LocalizedString $localizedName)
243  {
244  $this->localizedName = $localizedName;
245 
246  return $this;
247  }
248 
253  public function withDescription(?string $description)
254  {
255  $this->description = $description;
256 
257  return $this;
258  }
259 
264  public function withLocalizedDescription(?LocalizedString $localizedDescription)
265  {
266  $this->localizedDescription = $localizedDescription;
267 
268  return $this;
269  }
270 
275  public function withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
276  {
277  $this->taxCategory = $taxCategory;
278 
279  return $this;
280  }
281 
286  public function withZoneRates(?ZoneRateDraftCollection $zoneRates)
287  {
288  $this->zoneRates = $zoneRates;
289 
290  return $this;
291  }
292 
297  public function withActive(?bool $active)
298  {
299  $this->active = $active;
300 
301  return $this;
302  }
303 
308  public function withIsDefault(?bool $isDefault)
309  {
310  $this->isDefault = $isDefault;
311 
312  return $this;
313  }
314 
319  public function withPredicate(?string $predicate)
320  {
321  $this->predicate = $predicate;
322 
323  return $this;
324  }
325 
330  public function withCustom(?CustomFieldsDraft $custom)
331  {
332  $this->custom = $custom;
333 
334  return $this;
335  }
336 
341  public function withLocalizedNameBuilder(?LocalizedStringBuilder $localizedName)
342  {
343  $this->localizedName = $localizedName;
344 
345  return $this;
346  }
347 
352  public function withLocalizedDescriptionBuilder(?LocalizedStringBuilder $localizedDescription)
353  {
354  $this->localizedDescription = $localizedDescription;
355 
356  return $this;
357  }
358 
364  {
365  $this->taxCategory = $taxCategory;
366 
367  return $this;
368  }
369 
374  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
375  {
376  $this->custom = $custom;
377 
378  return $this;
379  }
380 
381  public function build(): ShippingMethodDraft
382  {
383  return new ShippingMethodDraftModel(
384  $this->key,
385  $this->name,
386  $this->localizedName instanceof LocalizedStringBuilder ? $this->localizedName->build() : $this->localizedName,
387  $this->description,
388  $this->localizedDescription instanceof LocalizedStringBuilder ? $this->localizedDescription->build() : $this->localizedDescription,
389  $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
390  $this->zoneRates,
391  $this->active,
392  $this->isDefault,
393  $this->predicate,
394  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
395  );
396  }
397 
398  public static function of(): ShippingMethodDraftBuilder
399  {
400  return new self();
401  }
402 }
withLocalizedDescriptionBuilder(?LocalizedStringBuilder $localizedDescription)
withTaxCategoryBuilder(?TaxCategoryResourceIdentifierBuilder $taxCategory)