commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
StateDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
23final class StateDraftBuilder implements Builder
24{
29 private $key;
30
35 private $type;
36
41 private $name;
42
47 private $description;
48
53 private $initial;
54
59 private $roles;
60
65 private $transitions;
66
75 public function getKey()
76 {
77 return $this->key;
78 }
79
86 public function getType()
87 {
88 return $this->type;
89 }
90
97 public function getName()
98 {
99 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
100 }
101
108 public function getDescription()
109 {
110 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
111 }
112
119 public function getInitial()
120 {
121 return $this->initial;
122 }
123
130 public function getRoles()
131 {
132 return $this->roles;
133 }
134
146 public function getTransitions()
147 {
148 return $this->transitions;
149 }
150
155 public function withKey(?string $key)
156 {
157 $this->key = $key;
158
159 return $this;
160 }
161
166 public function withType(?string $type)
167 {
168 $this->type = $type;
169
170 return $this;
171 }
172
177 public function withName(?LocalizedString $name)
178 {
179 $this->name = $name;
180
181 return $this;
182 }
183
188 public function withDescription(?LocalizedString $description)
189 {
190 $this->description = $description;
191
192 return $this;
193 }
194
199 public function withInitial(?bool $initial)
200 {
201 $this->initial = $initial;
202
203 return $this;
204 }
205
210 public function withRoles(?array $roles)
211 {
212 $this->roles = $roles;
213
214 return $this;
215 }
216
222 {
223 $this->transitions = $transitions;
224
225 return $this;
226 }
227
233 {
234 $this->name = $name;
235
236 return $this;
237 }
238
243 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
244 {
245 $this->description = $description;
246
247 return $this;
248 }
249
250 public function build(): StateDraft
251 {
252 return new StateDraftModel(
253 $this->key,
254 $this->type,
255 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
256 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
257 $this->initial,
258 $this->roles,
259 $this->transitions
260 );
261 }
262
263 public static function of(): StateDraftBuilder
264 {
265 return new self();
266 }
267}
withTransitions(?StateResourceIdentifierCollection $transitions)
withDescriptionBuilder(?LocalizedStringBuilder $description)