commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CategoryDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
21use stdClass;
22
26final class CategoryDraftBuilder implements Builder
27{
32 private $name;
33
38 private $slug;
39
44 private $description;
45
50 private $parent;
51
56 private $orderHint;
57
62 private $externalId;
63
68 private $metaTitle;
69
74 private $metaDescription;
75
80 private $metaKeywords;
81
86 private $custom;
87
92 private $assets;
93
98 private $key;
99
106 public function getName()
107 {
108 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
109 }
110
119 public function getSlug()
120 {
121 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
122 }
123
130 public function getDescription()
131 {
132 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
133 }
134
142 public function getParent()
143 {
144 return $this->parent instanceof CategoryResourceIdentifierBuilder ? $this->parent->build() : $this->parent;
145 }
146
154 public function getOrderHint()
155 {
156 return $this->orderHint;
157 }
158
165 public function getExternalId()
166 {
167 return $this->externalId;
168 }
169
176 public function getMetaTitle()
177 {
178 return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
179 }
180
187 public function getMetaDescription()
188 {
189 return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
190 }
191
198 public function getMetaKeywords()
199 {
200 return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
201 }
202
209 public function getCustom()
210 {
211 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
212 }
213
220 public function getAssets()
221 {
222 return $this->assets;
223 }
224
232 public function getKey()
233 {
234 return $this->key;
235 }
236
241 public function withName(?LocalizedString $name)
242 {
243 $this->name = $name;
244
245 return $this;
246 }
247
252 public function withSlug(?LocalizedString $slug)
253 {
254 $this->slug = $slug;
255
256 return $this;
257 }
258
263 public function withDescription(?LocalizedString $description)
264 {
265 $this->description = $description;
266
267 return $this;
268 }
269
274 public function withParent(?CategoryResourceIdentifier $parent)
275 {
276 $this->parent = $parent;
277
278 return $this;
279 }
280
285 public function withOrderHint(?string $orderHint)
286 {
287 $this->orderHint = $orderHint;
288
289 return $this;
290 }
291
296 public function withExternalId(?string $externalId)
297 {
298 $this->externalId = $externalId;
299
300 return $this;
301 }
302
307 public function withMetaTitle(?LocalizedString $metaTitle)
308 {
309 $this->metaTitle = $metaTitle;
310
311 return $this;
312 }
313
318 public function withMetaDescription(?LocalizedString $metaDescription)
319 {
320 $this->metaDescription = $metaDescription;
321
322 return $this;
323 }
324
329 public function withMetaKeywords(?LocalizedString $metaKeywords)
330 {
331 $this->metaKeywords = $metaKeywords;
332
333 return $this;
334 }
335
340 public function withCustom(?CustomFieldsDraft $custom)
341 {
342 $this->custom = $custom;
343
344 return $this;
345 }
346
351 public function withAssets(?AssetDraftCollection $assets)
352 {
353 $this->assets = $assets;
354
355 return $this;
356 }
357
362 public function withKey(?string $key)
363 {
364 $this->key = $key;
365
366 return $this;
367 }
368
374 {
375 $this->name = $name;
376
377 return $this;
378 }
379
385 {
386 $this->slug = $slug;
387
388 return $this;
389 }
390
395 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
396 {
397 $this->description = $description;
398
399 return $this;
400 }
401
407 {
408 $this->parent = $parent;
409
410 return $this;
411 }
412
417 public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
418 {
419 $this->metaTitle = $metaTitle;
420
421 return $this;
422 }
423
428 public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
429 {
430 $this->metaDescription = $metaDescription;
431
432 return $this;
433 }
434
439 public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
440 {
441 $this->metaKeywords = $metaKeywords;
442
443 return $this;
444 }
445
451 {
452 $this->custom = $custom;
453
454 return $this;
455 }
456
457 public function build(): CategoryDraft
458 {
459 return new CategoryDraftModel(
460 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
461 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
462 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
463 $this->parent instanceof CategoryResourceIdentifierBuilder ? $this->parent->build() : $this->parent,
464 $this->orderHint,
465 $this->externalId,
466 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
467 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
468 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
469 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
470 $this->assets,
471 $this->key
472 );
473 }
474
475 public static function of(): CategoryDraftBuilder
476 {
477 return new self();
478 }
479}
withDescriptionBuilder(?LocalizedStringBuilder $description)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withParentBuilder(?CategoryResourceIdentifierBuilder $parent)
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)