commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductSelectionBuilder.php
1<?php
2
3declare(strict_types=1);
10
26use DateTimeImmutable;
27use stdClass;
28
32final class ProductSelectionBuilder implements Builder
33{
38 private $id;
39
44 private $version;
45
50 private $createdAt;
51
56 private $lastModifiedAt;
57
62 private $lastModifiedBy;
63
68 private $createdBy;
69
74 private $key;
75
80 private $name;
81
86 private $productCount;
87
92 private $mode;
93
98 private $custom;
99
106 public function getId()
107 {
108 return $this->id;
109 }
110
117 public function getVersion()
118 {
119 return $this->version;
120 }
121
128 public function getCreatedAt()
129 {
130 return $this->createdAt;
131 }
132
139 public function getLastModifiedAt()
140 {
141 return $this->lastModifiedAt;
142 }
143
150 public function getLastModifiedBy()
151 {
152 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
153 }
154
161 public function getCreatedBy()
162 {
163 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
164 }
165
172 public function getKey()
173 {
174 return $this->key;
175 }
176
183 public function getName()
184 {
185 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
186 }
187
194 public function getProductCount()
195 {
196 return $this->productCount;
197 }
198
206 public function getMode()
207 {
208 return $this->mode;
209 }
210
217 public function getCustom()
218 {
219 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
220 }
221
226 public function withId(?string $id)
227 {
228 $this->id = $id;
229
230 return $this;
231 }
232
237 public function withVersion(?int $version)
238 {
239 $this->version = $version;
240
241 return $this;
242 }
243
248 public function withCreatedAt(?DateTimeImmutable $createdAt)
249 {
250 $this->createdAt = $createdAt;
251
252 return $this;
253 }
254
259 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
260 {
261 $this->lastModifiedAt = $lastModifiedAt;
262
263 return $this;
264 }
265
270 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
271 {
272 $this->lastModifiedBy = $lastModifiedBy;
273
274 return $this;
275 }
276
281 public function withCreatedBy(?CreatedBy $createdBy)
282 {
283 $this->createdBy = $createdBy;
284
285 return $this;
286 }
287
292 public function withKey(?string $key)
293 {
294 $this->key = $key;
295
296 return $this;
297 }
298
303 public function withName(?LocalizedString $name)
304 {
305 $this->name = $name;
306
307 return $this;
308 }
309
314 public function withProductCount(?int $productCount)
315 {
316 $this->productCount = $productCount;
317
318 return $this;
319 }
320
325 public function withMode(?string $mode)
326 {
327 $this->mode = $mode;
328
329 return $this;
330 }
331
336 public function withCustom(?CustomFields $custom)
337 {
338 $this->custom = $custom;
339
340 return $this;
341 }
342
347 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
348 {
349 $this->lastModifiedBy = $lastModifiedBy;
350
351 return $this;
352 }
353
358 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
359 {
360 $this->createdBy = $createdBy;
361
362 return $this;
363 }
364
370 {
371 $this->name = $name;
372
373 return $this;
374 }
375
380 public function withCustomBuilder(?CustomFieldsBuilder $custom)
381 {
382 $this->custom = $custom;
383
384 return $this;
385 }
386
387 public function build(): ProductSelection
388 {
389 return new ProductSelectionModel(
390 $this->id,
391 $this->version,
392 $this->createdAt,
393 $this->lastModifiedAt,
394 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
395 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
396 $this->key,
397 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
398 $this->productCount,
399 $this->mode,
400 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
401 );
402 }
403
404 public static function of(): ProductSelectionBuilder
405 {
406 return new self();
407 }
408}