commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
StateBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use DateTimeImmutable;
25 use stdClass;
26 
30 final class StateBuilder implements Builder
31 {
36  private $id;
37 
42  private $version;
43 
48  private $createdAt;
49 
54  private $lastModifiedAt;
55 
60  private $lastModifiedBy;
61 
66  private $createdBy;
67 
72  private $key;
73 
78  private $type;
79 
84  private $name;
85 
90  private $description;
91 
96  private $initial;
97 
102  private $builtIn;
103 
108  private $roles;
109 
114  private $transitions;
115 
122  public function getId()
123  {
124  return $this->id;
125  }
126 
133  public function getVersion()
134  {
135  return $this->version;
136  }
137 
144  public function getCreatedAt()
145  {
146  return $this->createdAt;
147  }
148 
155  public function getLastModifiedAt()
156  {
157  return $this->lastModifiedAt;
158  }
159 
166  public function getLastModifiedBy()
167  {
168  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
169  }
170 
177  public function getCreatedBy()
178  {
179  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
180  }
181 
188  public function getKey()
189  {
190  return $this->key;
191  }
192 
199  public function getType()
200  {
201  return $this->type;
202  }
203 
210  public function getName()
211  {
212  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
213  }
214 
221  public function getDescription()
222  {
223  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
224  }
225 
232  public function getInitial()
233  {
234  return $this->initial;
235  }
236 
243  public function getBuiltIn()
244  {
245  return $this->builtIn;
246  }
247 
254  public function getRoles()
255  {
256  return $this->roles;
257  }
258 
269  public function getTransitions()
270  {
271  return $this->transitions;
272  }
273 
278  public function withId(?string $id)
279  {
280  $this->id = $id;
281 
282  return $this;
283  }
284 
289  public function withVersion(?int $version)
290  {
291  $this->version = $version;
292 
293  return $this;
294  }
295 
300  public function withCreatedAt(?DateTimeImmutable $createdAt)
301  {
302  $this->createdAt = $createdAt;
303 
304  return $this;
305  }
306 
311  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
312  {
313  $this->lastModifiedAt = $lastModifiedAt;
314 
315  return $this;
316  }
317 
322  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
323  {
324  $this->lastModifiedBy = $lastModifiedBy;
325 
326  return $this;
327  }
328 
333  public function withCreatedBy(?CreatedBy $createdBy)
334  {
335  $this->createdBy = $createdBy;
336 
337  return $this;
338  }
339 
344  public function withKey(?string $key)
345  {
346  $this->key = $key;
347 
348  return $this;
349  }
350 
355  public function withType(?string $type)
356  {
357  $this->type = $type;
358 
359  return $this;
360  }
361 
366  public function withName(?LocalizedString $name)
367  {
368  $this->name = $name;
369 
370  return $this;
371  }
372 
377  public function withDescription(?LocalizedString $description)
378  {
379  $this->description = $description;
380 
381  return $this;
382  }
383 
388  public function withInitial(?bool $initial)
389  {
390  $this->initial = $initial;
391 
392  return $this;
393  }
394 
399  public function withBuiltIn(?bool $builtIn)
400  {
401  $this->builtIn = $builtIn;
402 
403  return $this;
404  }
405 
410  public function withRoles(?array $roles)
411  {
412  $this->roles = $roles;
413 
414  return $this;
415  }
416 
421  public function withTransitions(?StateReferenceCollection $transitions)
422  {
423  $this->transitions = $transitions;
424 
425  return $this;
426  }
427 
432  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
433  {
434  $this->lastModifiedBy = $lastModifiedBy;
435 
436  return $this;
437  }
438 
443  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
444  {
445  $this->createdBy = $createdBy;
446 
447  return $this;
448  }
449 
454  public function withNameBuilder(?LocalizedStringBuilder $name)
455  {
456  $this->name = $name;
457 
458  return $this;
459  }
460 
465  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
466  {
467  $this->description = $description;
468 
469  return $this;
470  }
471 
472  public function build(): State
473  {
474  return new StateModel(
475  $this->id,
476  $this->version,
477  $this->createdAt,
478  $this->lastModifiedAt,
479  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
480  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
481  $this->key,
482  $this->type,
483  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
484  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
485  $this->initial,
486  $this->builtIn,
487  $this->roles,
488  $this->transitions
489  );
490  }
491 
492  public static function of(): StateBuilder
493  {
494  return new self();
495  }
496 }
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withNameBuilder(?LocalizedStringBuilder $name)
withDescription(?LocalizedString $description)
withCreatedAt(?DateTimeImmutable $createdAt)
withCreatedByBuilder(?CreatedByBuilder $createdBy)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withTransitions(?StateReferenceCollection $transitions)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)