commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DiscountCodeImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
23 use DateTimeImmutable;
24 use stdClass;
25 
29 final class DiscountCodeImportBuilder implements Builder
30 {
35  private $key;
36 
41  private $name;
42 
47  private $description;
48 
53  private $code;
54 
59  private $cartDiscounts;
60 
65  private $cartPredicate;
66 
71  private $isActive;
72 
77  private $maxApplications;
78 
83  private $maxApplicationsPerCustomer;
84 
89  private $groups;
90 
95  private $validFrom;
96 
101  private $validUntil;
102 
107  private $custom;
108 
115  public function getKey()
116  {
117  return $this->key;
118  }
119 
126  public function getName()
127  {
128  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
129  }
130 
137  public function getDescription()
138  {
139  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
140  }
141 
149  public function getCode()
150  {
151  return $this->code;
152  }
153 
160  public function getCartDiscounts()
161  {
162  return $this->cartDiscounts;
163  }
164 
171  public function getCartPredicate()
172  {
173  return $this->cartPredicate;
174  }
175 
182  public function getIsActive()
183  {
184  return $this->isActive;
185  }
186 
193  public function getMaxApplications()
194  {
195  return $this->maxApplications;
196  }
197 
205  {
206  return $this->maxApplicationsPerCustomer;
207  }
208 
215  public function getGroups()
216  {
217  return $this->groups;
218  }
219 
226  public function getValidFrom()
227  {
228  return $this->validFrom;
229  }
230 
237  public function getValidUntil()
238  {
239  return $this->validUntil;
240  }
241 
248  public function getCustom()
249  {
250  return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
251  }
252 
257  public function withKey(?string $key)
258  {
259  $this->key = $key;
260 
261  return $this;
262  }
263 
268  public function withName(?LocalizedString $name)
269  {
270  $this->name = $name;
271 
272  return $this;
273  }
274 
279  public function withDescription(?LocalizedString $description)
280  {
281  $this->description = $description;
282 
283  return $this;
284  }
285 
290  public function withCode(?string $code)
291  {
292  $this->code = $code;
293 
294  return $this;
295  }
296 
301  public function withCartDiscounts(?CartDiscountKeyReferenceCollection $cartDiscounts)
302  {
303  $this->cartDiscounts = $cartDiscounts;
304 
305  return $this;
306  }
307 
312  public function withCartPredicate(?string $cartPredicate)
313  {
314  $this->cartPredicate = $cartPredicate;
315 
316  return $this;
317  }
318 
323  public function withIsActive(?bool $isActive)
324  {
325  $this->isActive = $isActive;
326 
327  return $this;
328  }
329 
334  public function withMaxApplications(?int $maxApplications)
335  {
336  $this->maxApplications = $maxApplications;
337 
338  return $this;
339  }
340 
345  public function withMaxApplicationsPerCustomer(?int $maxApplicationsPerCustomer)
346  {
347  $this->maxApplicationsPerCustomer = $maxApplicationsPerCustomer;
348 
349  return $this;
350  }
351 
356  public function withGroups(?array $groups)
357  {
358  $this->groups = $groups;
359 
360  return $this;
361  }
362 
367  public function withValidFrom(?DateTimeImmutable $validFrom)
368  {
369  $this->validFrom = $validFrom;
370 
371  return $this;
372  }
373 
378  public function withValidUntil(?DateTimeImmutable $validUntil)
379  {
380  $this->validUntil = $validUntil;
381 
382  return $this;
383  }
384 
389  public function withCustom(?Custom $custom)
390  {
391  $this->custom = $custom;
392 
393  return $this;
394  }
395 
400  public function withNameBuilder(?LocalizedStringBuilder $name)
401  {
402  $this->name = $name;
403 
404  return $this;
405  }
406 
411  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
412  {
413  $this->description = $description;
414 
415  return $this;
416  }
417 
422  public function withCustomBuilder(?CustomBuilder $custom)
423  {
424  $this->custom = $custom;
425 
426  return $this;
427  }
428 
429  public function build(): DiscountCodeImport
430  {
431  return new DiscountCodeImportModel(
432  $this->key,
433  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
434  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
435  $this->code,
436  $this->cartDiscounts,
437  $this->cartPredicate,
438  $this->isActive,
439  $this->maxApplications,
440  $this->maxApplicationsPerCustomer,
441  $this->groups,
442  $this->validFrom,
443  $this->validUntil,
444  $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
445  );
446  }
447 
448  public static function of(): DiscountCodeImportBuilder
449  {
450  return new self();
451  }
452 }
withCartDiscounts(?CartDiscountKeyReferenceCollection $cartDiscounts)