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
73 public function getKey()
74 {
75 return $this->key;
76 }
77
84 public function getDescription()
85 {
86 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
87 }
88
96 public function getSortOrder()
97 {
98 return $this->sortOrder;
99 }
100
107 public function getIsActive()
108 {
109 return $this->isActive;
110 }
111
116 public function withName(?LocalizedString $name)
117 {
118 $this->name = $name;
119
120 return $this;
121 }
122
127 public function withKey(?string $key)
128 {
129 $this->key = $key;
130
131 return $this;
132 }
133
138 public function withDescription(?LocalizedString $description)
139 {
140 $this->description = $description;
141
142 return $this;
143 }
144
149 public function withSortOrder(?string $sortOrder)
150 {
151 $this->sortOrder = $sortOrder;
152
153 return $this;
154 }
155
160 public function withIsActive(?bool $isActive)
161 {
162 $this->isActive = $isActive;
163
164 return $this;
165 }
166
172 {
173 $this->name = $name;
174
175 return $this;
176 }
177
182 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
183 {
184 $this->description = $description;
185
186 return $this;
187 }
188
189 public function build(): DiscountGroupDraft
190 {
191 return new DiscountGroupDraftModel(
192 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
193 $this->key,
194 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
195 $this->sortOrder,
196 $this->isActive
197 );
198 }
199
200 public static function of(): DiscountGroupDraftBuilder
201 {
202 return new self();
203 }
204}