commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
StateDraftModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
22final class StateDraftModel extends JsonObjectModel implements StateDraft
23{
28 protected $key;
29
34 protected $type;
35
40 protected $name;
41
46 protected $description;
47
52 protected $initial;
53
58 protected $roles;
59
64 protected $transitions;
65
66
70 public function __construct(
71 ?string $key = null,
72 ?string $type = null,
73 ?LocalizedString $name = null,
75 ?bool $initial = null,
76 ?array $roles = null,
78 ) {
79 $this->key = $key;
80 $this->type = $type;
81 $this->name = $name;
82 $this->description = $description;
83 $this->initial = $initial;
84 $this->roles = $roles;
85 $this->transitions = $transitions;
86 }
87
94 public function getKey()
95 {
96 if (is_null($this->key)) {
98 $data = $this->raw(self::FIELD_KEY);
99 if (is_null($data)) {
100 return null;
101 }
102 $this->key = (string) $data;
103 }
104
105 return $this->key;
106 }
107
114 public function getType()
115 {
116 if (is_null($this->type)) {
118 $data = $this->raw(self::FIELD_TYPE);
119 if (is_null($data)) {
120 return null;
121 }
122 $this->type = (string) $data;
123 }
124
125 return $this->type;
126 }
127
134 public function getName()
135 {
136 if (is_null($this->name)) {
138 $data = $this->raw(self::FIELD_NAME);
139 if (is_null($data)) {
140 return null;
141 }
142
143 $this->name = LocalizedStringModel::of($data);
144 }
145
146 return $this->name;
147 }
148
155 public function getDescription()
156 {
157 if (is_null($this->description)) {
159 $data = $this->raw(self::FIELD_DESCRIPTION);
160 if (is_null($data)) {
161 return null;
162 }
163
164 $this->description = LocalizedStringModel::of($data);
165 }
166
167 return $this->description;
168 }
169
176 public function getInitial()
177 {
178 if (is_null($this->initial)) {
180 $data = $this->raw(self::FIELD_INITIAL);
181 if (is_null($data)) {
182 return null;
183 }
184 $this->initial = (bool) $data;
185 }
186
187 return $this->initial;
188 }
189
196 public function getRoles()
197 {
198 if (is_null($this->roles)) {
200 $data = $this->raw(self::FIELD_ROLES);
201 if (is_null($data)) {
202 return null;
203 }
204 $this->roles = $data;
205 }
206
207 return $this->roles;
208 }
209
221 public function getTransitions()
222 {
223 if (is_null($this->transitions)) {
225 $data = $this->raw(self::FIELD_TRANSITIONS);
226 if (is_null($data)) {
227 return null;
228 }
229 $this->transitions = StateResourceIdentifierCollection::fromArray($data);
230 }
231
232 return $this->transitions;
233 }
234
235
239 public function setKey(?string $key): void
240 {
241 $this->key = $key;
242 }
243
247 public function setType(?string $type): void
248 {
249 $this->type = $type;
250 }
251
255 public function setName(?LocalizedString $name): void
256 {
257 $this->name = $name;
258 }
259
264 {
265 $this->description = $description;
266 }
267
271 public function setInitial(?bool $initial): void
272 {
273 $this->initial = $initial;
274 }
275
279 public function setRoles(?array $roles): void
280 {
281 $this->roles = $roles;
282 }
283
288 {
289 $this->transitions = $transitions;
290 }
291}
setTransitions(?StateResourceIdentifierCollection $transitions)
__construct(?string $key=null, ?string $type=null, ?LocalizedString $name=null, ?LocalizedString $description=null, ?bool $initial=null, ?array $roles=null, ?StateResourceIdentifierCollection $transitions=null)
setDescription(?LocalizedString $description)
static fromArray(array $data)