commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
AttributeGroupBuilder.php
1<?php
2
3declare(strict_types=1);
10
24use DateTimeImmutable;
25use stdClass;
26
30final class AttributeGroupBuilder implements Builder
31{
36 private $id;
37
42 private $version;
43
48 private $createdAt;
49
54 private $lastModifiedAt;
55
60 private $lastModifiedBy;
61
66 private $createdBy;
67
72 private $name;
73
78 private $description;
79
84 private $attributes;
85
90 private $key;
91
98 public function getId()
99 {
100 return $this->id;
101 }
102
109 public function getVersion()
110 {
111 return $this->version;
112 }
113
120 public function getCreatedAt()
121 {
122 return $this->createdAt;
123 }
124
131 public function getLastModifiedAt()
132 {
133 return $this->lastModifiedAt;
134 }
135
142 public function getLastModifiedBy()
143 {
144 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
145 }
146
153 public function getCreatedBy()
154 {
155 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
156 }
157
164 public function getName()
165 {
166 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
167 }
168
175 public function getDescription()
176 {
177 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
178 }
179
186 public function getAttributes()
187 {
188 return $this->attributes;
189 }
190
197 public function getKey()
198 {
199 return $this->key;
200 }
201
206 public function withId(?string $id)
207 {
208 $this->id = $id;
209
210 return $this;
211 }
212
217 public function withVersion(?int $version)
218 {
219 $this->version = $version;
220
221 return $this;
222 }
223
228 public function withCreatedAt(?DateTimeImmutable $createdAt)
229 {
230 $this->createdAt = $createdAt;
231
232 return $this;
233 }
234
239 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
240 {
241 $this->lastModifiedAt = $lastModifiedAt;
242
243 return $this;
244 }
245
250 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
251 {
252 $this->lastModifiedBy = $lastModifiedBy;
253
254 return $this;
255 }
256
261 public function withCreatedBy(?CreatedBy $createdBy)
262 {
263 $this->createdBy = $createdBy;
264
265 return $this;
266 }
267
272 public function withName(?LocalizedString $name)
273 {
274 $this->name = $name;
275
276 return $this;
277 }
278
283 public function withDescription(?LocalizedString $description)
284 {
285 $this->description = $description;
286
287 return $this;
288 }
289
294 public function withAttributes(?AttributeReferenceCollection $attributes)
295 {
296 $this->attributes = $attributes;
297
298 return $this;
299 }
300
305 public function withKey(?string $key)
306 {
307 $this->key = $key;
308
309 return $this;
310 }
311
316 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
317 {
318 $this->lastModifiedBy = $lastModifiedBy;
319
320 return $this;
321 }
322
327 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
328 {
329 $this->createdBy = $createdBy;
330
331 return $this;
332 }
333
339 {
340 $this->name = $name;
341
342 return $this;
343 }
344
349 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
350 {
351 $this->description = $description;
352
353 return $this;
354 }
355
356 public function build(): AttributeGroup
357 {
358 return new AttributeGroupModel(
359 $this->id,
360 $this->version,
361 $this->createdAt,
362 $this->lastModifiedAt,
363 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
364 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
365 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
366 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
367 $this->attributes,
368 $this->key
369 );
370 }
371
372 public static function of(): AttributeGroupBuilder
373 {
374 return new self();
375 }
376}