commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
QuoteStateTransitionMessagePayloadModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
24  public const DISCRIMINATOR_VALUE = 'QuoteStateTransition';
29  protected $type;
30 
35  protected $state;
36 
41  protected $oldState;
42 
47  protected $force;
48 
49 
53  public function __construct(
54  ?StateReference $state = null,
55  ?StateReference $oldState = null,
56  ?bool $force = null,
57  ?string $type = null
58  ) {
59  $this->state = $state;
60  $this->oldState = $oldState;
61  $this->force = $force;
62  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
63  }
64 
69  public function getType()
70  {
71  if (is_null($this->type)) {
73  $data = $this->raw(self::FIELD_TYPE);
74  if (is_null($data)) {
75  return null;
76  }
77  $this->type = (string) $data;
78  }
79 
80  return $this->type;
81  }
82 
89  public function getState()
90  {
91  if (is_null($this->state)) {
93  $data = $this->raw(self::FIELD_STATE);
94  if (is_null($data)) {
95  return null;
96  }
97 
98  $this->state = StateReferenceModel::of($data);
99  }
100 
101  return $this->state;
102  }
103 
110  public function getOldState()
111  {
112  if (is_null($this->oldState)) {
114  $data = $this->raw(self::FIELD_OLD_STATE);
115  if (is_null($data)) {
116  return null;
117  }
118 
119  $this->oldState = StateReferenceModel::of($data);
120  }
121 
122  return $this->oldState;
123  }
124 
131  public function getForce()
132  {
133  if (is_null($this->force)) {
135  $data = $this->raw(self::FIELD_FORCE);
136  if (is_null($data)) {
137  return null;
138  }
139  $this->force = (bool) $data;
140  }
141 
142  return $this->force;
143  }
144 
145 
149  public function setState(?StateReference $state): void
150  {
151  $this->state = $state;
152  }
153 
157  public function setOldState(?StateReference $oldState): void
158  {
159  $this->oldState = $oldState;
160  }
161 
165  public function setForce(?bool $force): void
166  {
167  $this->force = $force;
168  }
169 }
__construct(?StateReference $state=null, ?StateReference $oldState=null, ?bool $force=null, ?string $type=null)