commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductLabelBuilder.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
19
23final class ProductLabelBuilder implements Builder
24{
29 private $slug;
30
35 private $name;
36
43 public function getSlug()
44 {
45 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
46 }
47
54 public function getName()
55 {
56 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
57 }
58
63 public function withSlug(?LocalizedString $slug)
64 {
65 $this->slug = $slug;
66
67 return $this;
68 }
69
74 public function withName(?LocalizedString $name)
75 {
76 $this->name = $name;
77
78 return $this;
79 }
80
86 {
87 $this->slug = $slug;
88
89 return $this;
90 }
91
97 {
98 $this->name = $name;
99
100 return $this;
101 }
102
103 public function build(): ProductLabel
104 {
105 return new ProductLabelModel(
106 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
107 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name
108 );
109 }
110
111 public static function of(): ProductLabelBuilder
112 {
113 return new self();
114 }
115}