commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DiscountGroupDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class DiscountGroupDraftBuilder implements Builder
24{
29 private $name;
30
35 private $key;
36
41 private $description;
42
47 private $sortOrder;
48
53 private $isActive;
54
61 public function getName()
62 {
63 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
64 }
65
72 public function getKey()
73 {
74 return $this->key;
75 }
76
83 public function getDescription()
84 {
85 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
86 }
87
95 public function getSortOrder()
96 {
97 return $this->sortOrder;
98 }
99
106 public function getIsActive()
107 {
108 return $this->isActive;
109 }
110
115 public function withName(?LocalizedString $name)
116 {
117 $this->name = $name;
118
119 return $this;
120 }
121
126 public function withKey(?string $key)
127 {
128 $this->key = $key;
129
130 return $this;
131 }
132
137 public function withDescription(?LocalizedString $description)
138 {
139 $this->description = $description;
140
141 return $this;
142 }
143
148 public function withSortOrder(?string $sortOrder)
149 {
150 $this->sortOrder = $sortOrder;
151
152 return $this;
153 }
154
159 public function withIsActive(?bool $isActive)
160 {
161 $this->isActive = $isActive;
162
163 return $this;
164 }
165
171 {
172 $this->name = $name;
173
174 return $this;
175 }
176
181 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
182 {
183 $this->description = $description;
184
185 return $this;
186 }
187
188 public function build(): DiscountGroupDraft
189 {
190 return new DiscountGroupDraftModel(
191 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
192 $this->key,
193 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
194 $this->sortOrder,
195 $this->isActive
196 );
197 }
198
199 public static function of(): DiscountGroupDraftBuilder
200 {
201 return new self();
202 }
203}