commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DiscountCodeImportBuilder.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
29final 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
148 public function getCode()
149 {
150 return $this->code;
151 }
152
159 public function getCartDiscounts()
160 {
161 return $this->cartDiscounts;
162 }
163
170 public function getCartPredicate()
171 {
172 return $this->cartPredicate;
173 }
174
181 public function getIsActive()
182 {
183 return $this->isActive;
184 }
185
192 public function getMaxApplications()
193 {
194 return $this->maxApplications;
195 }
196
204 {
205 return $this->maxApplicationsPerCustomer;
206 }
207
214 public function getGroups()
215 {
216 return $this->groups;
217 }
218
225 public function getValidFrom()
226 {
227 return $this->validFrom;
228 }
229
236 public function getValidUntil()
237 {
238 return $this->validUntil;
239 }
240
247 public function getCustom()
248 {
249 return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
250 }
251
256 public function withKey(?string $key)
257 {
258 $this->key = $key;
259
260 return $this;
261 }
262
267 public function withName(?LocalizedString $name)
268 {
269 $this->name = $name;
270
271 return $this;
272 }
273
278 public function withDescription(?LocalizedString $description)
279 {
280 $this->description = $description;
281
282 return $this;
283 }
284
289 public function withCode(?string $code)
290 {
291 $this->code = $code;
292
293 return $this;
294 }
295
301 {
302 $this->cartDiscounts = $cartDiscounts;
303
304 return $this;
305 }
306
311 public function withCartPredicate(?string $cartPredicate)
312 {
313 $this->cartPredicate = $cartPredicate;
314
315 return $this;
316 }
317
322 public function withIsActive(?bool $isActive)
323 {
324 $this->isActive = $isActive;
325
326 return $this;
327 }
328
333 public function withMaxApplications(?int $maxApplications)
334 {
335 $this->maxApplications = $maxApplications;
336
337 return $this;
338 }
339
344 public function withMaxApplicationsPerCustomer(?int $maxApplicationsPerCustomer)
345 {
346 $this->maxApplicationsPerCustomer = $maxApplicationsPerCustomer;
347
348 return $this;
349 }
350
355 public function withGroups(?array $groups)
356 {
357 $this->groups = $groups;
358
359 return $this;
360 }
361
366 public function withValidFrom(?DateTimeImmutable $validFrom)
367 {
368 $this->validFrom = $validFrom;
369
370 return $this;
371 }
372
377 public function withValidUntil(?DateTimeImmutable $validUntil)
378 {
379 $this->validUntil = $validUntil;
380
381 return $this;
382 }
383
388 public function withCustom(?Custom $custom)
389 {
390 $this->custom = $custom;
391
392 return $this;
393 }
394
400 {
401 $this->name = $name;
402
403 return $this;
404 }
405
410 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
411 {
412 $this->description = $description;
413
414 return $this;
415 }
416
421 public function withCustomBuilder(?CustomBuilder $custom)
422 {
423 $this->custom = $custom;
424
425 return $this;
426 }
427
428 public function build(): DiscountCodeImport
429 {
430 return new DiscountCodeImportModel(
431 $this->key,
432 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
433 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
434 $this->code,
435 $this->cartDiscounts,
436 $this->cartPredicate,
437 $this->isActive,
438 $this->maxApplications,
439 $this->maxApplicationsPerCustomer,
440 $this->groups,
441 $this->validFrom,
442 $this->validUntil,
443 $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
444 );
445 }
446
447 public static function of(): DiscountCodeImportBuilder
448 {
449 return new self();
450 }
451}
withCartDiscounts(?CartDiscountKeyReferenceCollection $cartDiscounts)