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
96 public function getKey()
97 {
98 if (is_null($this->key)) {
100 $data = $this->raw(self::FIELD_KEY);
101 if (is_null($data)) {
102 return null;
103 }
104 $this->key = (string) $data;
105 }
106
107 return $this->key;
108 }
109
116 public function getType()
117 {
118 if (is_null($this->type)) {
120 $data = $this->raw(self::FIELD_TYPE);
121 if (is_null($data)) {
122 return null;
123 }
124 $this->type = (string) $data;
125 }
126
127 return $this->type;
128 }
129
136 public function getName()
137 {
138 if (is_null($this->name)) {
140 $data = $this->raw(self::FIELD_NAME);
141 if (is_null($data)) {
142 return null;
143 }
144
145 $this->name = LocalizedStringModel::of($data);
146 }
147
148 return $this->name;
149 }
150
157 public function getDescription()
158 {
159 if (is_null($this->description)) {
161 $data = $this->raw(self::FIELD_DESCRIPTION);
162 if (is_null($data)) {
163 return null;
164 }
165
166 $this->description = LocalizedStringModel::of($data);
167 }
168
169 return $this->description;
170 }
171
178 public function getInitial()
179 {
180 if (is_null($this->initial)) {
182 $data = $this->raw(self::FIELD_INITIAL);
183 if (is_null($data)) {
184 return null;
185 }
186 $this->initial = (bool) $data;
187 }
188
189 return $this->initial;
190 }
191
198 public function getRoles()
199 {
200 if (is_null($this->roles)) {
202 $data = $this->raw(self::FIELD_ROLES);
203 if (is_null($data)) {
204 return null;
205 }
206 $this->roles = $data;
207 }
208
209 return $this->roles;
210 }
211
223 public function getTransitions()
224 {
225 if (is_null($this->transitions)) {
227 $data = $this->raw(self::FIELD_TRANSITIONS);
228 if (is_null($data)) {
229 return null;
230 }
231 $this->transitions = StateResourceIdentifierCollection::fromArray($data);
232 }
233
234 return $this->transitions;
235 }
236
237
241 public function setKey(?string $key): void
242 {
243 $this->key = $key;
244 }
245
249 public function setType(?string $type): void
250 {
251 $this->type = $type;
252 }
253
257 public function setName(?LocalizedString $name): void
258 {
259 $this->name = $name;
260 }
261
266 {
267 $this->description = $description;
268 }
269
273 public function setInitial(?bool $initial): void
274 {
275 $this->initial = $initial;
276 }
277
281 public function setRoles(?array $roles): void
282 {
283 $this->roles = $roles;
284 }
285
290 {
291 $this->transitions = $transitions;
292 }
293}
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)