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
73 public function getKey()
74 {
75 return $this->key;
76 }
77
84 public function getType()
85 {
86 return $this->type;
87 }
88
95 public function getName()
96 {
97 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
98 }
99
106 public function getDescription()
107 {
108 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
109 }
110
117 public function getInitial()
118 {
119 return $this->initial;
120 }
121
128 public function getRoles()
129 {
130 return $this->roles;
131 }
132
144 public function getTransitions()
145 {
146 return $this->transitions;
147 }
148
153 public function withKey(?string $key)
154 {
155 $this->key = $key;
156
157 return $this;
158 }
159
164 public function withType(?string $type)
165 {
166 $this->type = $type;
167
168 return $this;
169 }
170
175 public function withName(?LocalizedString $name)
176 {
177 $this->name = $name;
178
179 return $this;
180 }
181
186 public function withDescription(?LocalizedString $description)
187 {
188 $this->description = $description;
189
190 return $this;
191 }
192
197 public function withInitial(?bool $initial)
198 {
199 $this->initial = $initial;
200
201 return $this;
202 }
203
208 public function withRoles(?array $roles)
209 {
210 $this->roles = $roles;
211
212 return $this;
213 }
214
220 {
221 $this->transitions = $transitions;
222
223 return $this;
224 }
225
231 {
232 $this->name = $name;
233
234 return $this;
235 }
236
241 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
242 {
243 $this->description = $description;
244
245 return $this;
246 }
247
248 public function build(): StateDraft
249 {
250 return new StateDraftModel(
251 $this->key,
252 $this->type,
253 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
254 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
255 $this->initial,
256 $this->roles,
257 $this->transitions
258 );
259 }
260
261 public static function of(): StateDraftBuilder
262 {
263 return new self();
264 }
265}
withTransitions(?StateResourceIdentifierCollection $transitions)
withDescriptionBuilder(?LocalizedStringBuilder $description)