commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductDiscountDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use DateTimeImmutable;
19use stdClass;
20
25{
30 private $name;
31
36 private $key;
37
42 private $description;
43
48 private $value;
49
54 private $predicate;
55
60 private $sortOrder;
61
66 private $isActive;
67
72 private $validFrom;
73
78 private $validUntil;
79
86 public function getName()
87 {
88 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
89 }
90
98 public function getKey()
99 {
100 return $this->key;
101 }
102
109 public function getDescription()
110 {
111 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
112 }
113
120 public function getValue()
121 {
122 return $this->value instanceof ProductDiscountValueDraftBuilder ? $this->value->build() : $this->value;
123 }
124
131 public function getPredicate()
132 {
133 return $this->predicate;
134 }
135
143 public function getSortOrder()
144 {
145 return $this->sortOrder;
146 }
147
154 public function getIsActive()
155 {
156 return $this->isActive;
157 }
158
166 public function getValidFrom()
167 {
168 return $this->validFrom;
169 }
170
178 public function getValidUntil()
179 {
180 return $this->validUntil;
181 }
182
187 public function withName(?LocalizedString $name)
188 {
189 $this->name = $name;
190
191 return $this;
192 }
193
198 public function withKey(?string $key)
199 {
200 $this->key = $key;
201
202 return $this;
203 }
204
209 public function withDescription(?LocalizedString $description)
210 {
211 $this->description = $description;
212
213 return $this;
214 }
215
220 public function withValue(?ProductDiscountValueDraft $value)
221 {
222 $this->value = $value;
223
224 return $this;
225 }
226
231 public function withPredicate(?string $predicate)
232 {
233 $this->predicate = $predicate;
234
235 return $this;
236 }
237
242 public function withSortOrder(?string $sortOrder)
243 {
244 $this->sortOrder = $sortOrder;
245
246 return $this;
247 }
248
253 public function withIsActive(?bool $isActive)
254 {
255 $this->isActive = $isActive;
256
257 return $this;
258 }
259
264 public function withValidFrom(?DateTimeImmutable $validFrom)
265 {
266 $this->validFrom = $validFrom;
267
268 return $this;
269 }
270
275 public function withValidUntil(?DateTimeImmutable $validUntil)
276 {
277 $this->validUntil = $validUntil;
278
279 return $this;
280 }
281
287 {
288 $this->name = $name;
289
290 return $this;
291 }
292
297 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
298 {
299 $this->description = $description;
300
301 return $this;
302 }
303
309 {
310 $this->value = $value;
311
312 return $this;
313 }
314
315 public function build(): ProductDiscountDraft
316 {
317 return new ProductDiscountDraftModel(
318 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
319 $this->key,
320 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
321 $this->value instanceof ProductDiscountValueDraftBuilder ? $this->value->build() : $this->value,
322 $this->predicate,
323 $this->sortOrder,
324 $this->isActive,
325 $this->validFrom,
326 $this->validUntil
327 );
328 }
329
330 public static function of(): ProductDiscountDraftBuilder
331 {
332 return new self();
333 }
334}