commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DiscountGroupBuilder.php
1<?php
2
3declare(strict_types=1);
10
24use DateTimeImmutable;
25use stdClass;
26
30final class DiscountGroupBuilder implements Builder
31{
36 private $id;
37
42 private $version;
43
48 private $createdAt;
49
54 private $lastModifiedAt;
55
60 private $name;
61
66 private $key;
67
72 private $description;
73
78 private $sortOrder;
79
84 private $isActive;
85
90 private $lastModifiedBy;
91
96 private $createdBy;
97
104 public function getId()
105 {
106 return $this->id;
107 }
108
115 public function getVersion()
116 {
117 return $this->version;
118 }
119
126 public function getCreatedAt()
127 {
128 return $this->createdAt;
129 }
130
137 public function getLastModifiedAt()
138 {
139 return $this->lastModifiedAt;
140 }
141
148 public function getName()
149 {
150 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
151 }
152
159 public function getKey()
160 {
161 return $this->key;
162 }
163
170 public function getDescription()
171 {
172 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
173 }
174
182 public function getSortOrder()
183 {
184 return $this->sortOrder;
185 }
186
193 public function getIsActive()
194 {
195 return $this->isActive;
196 }
197
204 public function getLastModifiedBy()
205 {
206 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
207 }
208
215 public function getCreatedBy()
216 {
217 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
218 }
219
224 public function withId(?string $id)
225 {
226 $this->id = $id;
227
228 return $this;
229 }
230
235 public function withVersion(?int $version)
236 {
237 $this->version = $version;
238
239 return $this;
240 }
241
246 public function withCreatedAt(?DateTimeImmutable $createdAt)
247 {
248 $this->createdAt = $createdAt;
249
250 return $this;
251 }
252
257 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
258 {
259 $this->lastModifiedAt = $lastModifiedAt;
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 withKey(?string $key)
280 {
281 $this->key = $key;
282
283 return $this;
284 }
285
290 public function withDescription(?LocalizedString $description)
291 {
292 $this->description = $description;
293
294 return $this;
295 }
296
301 public function withSortOrder(?string $sortOrder)
302 {
303 $this->sortOrder = $sortOrder;
304
305 return $this;
306 }
307
312 public function withIsActive(?bool $isActive)
313 {
314 $this->isActive = $isActive;
315
316 return $this;
317 }
318
323 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
324 {
325 $this->lastModifiedBy = $lastModifiedBy;
326
327 return $this;
328 }
329
334 public function withCreatedBy(?CreatedBy $createdBy)
335 {
336 $this->createdBy = $createdBy;
337
338 return $this;
339 }
340
346 {
347 $this->name = $name;
348
349 return $this;
350 }
351
356 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
357 {
358 $this->description = $description;
359
360 return $this;
361 }
362
367 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
368 {
369 $this->lastModifiedBy = $lastModifiedBy;
370
371 return $this;
372 }
373
378 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
379 {
380 $this->createdBy = $createdBy;
381
382 return $this;
383 }
384
385 public function build(): DiscountGroup
386 {
387 return new DiscountGroupModel(
388 $this->id,
389 $this->version,
390 $this->createdAt,
391 $this->lastModifiedAt,
392 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
393 $this->key,
394 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
395 $this->sortOrder,
396 $this->isActive,
397 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
398 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy
399 );
400 }
401
402 public static function of(): DiscountGroupBuilder
403 {
404 return new self();
405 }
406}
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)