commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ReviewStateTransitionMessagePayloadModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
25 {
26  public const DISCRIMINATOR_VALUE = 'ReviewStateTransition';
31  protected $type;
32 
37  protected $oldState;
38 
43  protected $newState;
44 
50 
56 
61  protected $target;
62 
67  protected $force;
68 
69 
73  public function __construct(
74  ?StateReference $oldState = null,
75  ?StateReference $newState = null,
76  ?bool $oldIncludedInStatistics = null,
77  ?bool $newIncludedInStatistics = null,
78  ?Reference $target = null,
79  ?bool $force = null,
80  ?string $type = null
81  ) {
82  $this->oldState = $oldState;
83  $this->newState = $newState;
84  $this->oldIncludedInStatistics = $oldIncludedInStatistics;
85  $this->newIncludedInStatistics = $newIncludedInStatistics;
86  $this->target = $target;
87  $this->force = $force;
88  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
89  }
90 
95  public function getType()
96  {
97  if (is_null($this->type)) {
99  $data = $this->raw(self::FIELD_TYPE);
100  if (is_null($data)) {
101  return null;
102  }
103  $this->type = (string) $data;
104  }
105 
106  return $this->type;
107  }
108 
115  public function getOldState()
116  {
117  if (is_null($this->oldState)) {
119  $data = $this->raw(self::FIELD_OLD_STATE);
120  if (is_null($data)) {
121  return null;
122  }
123 
124  $this->oldState = StateReferenceModel::of($data);
125  }
126 
127  return $this->oldState;
128  }
129 
136  public function getNewState()
137  {
138  if (is_null($this->newState)) {
140  $data = $this->raw(self::FIELD_NEW_STATE);
141  if (is_null($data)) {
142  return null;
143  }
144 
145  $this->newState = StateReferenceModel::of($data);
146  }
147 
148  return $this->newState;
149  }
150 
157  public function getOldIncludedInStatistics()
158  {
159  if (is_null($this->oldIncludedInStatistics)) {
161  $data = $this->raw(self::FIELD_OLD_INCLUDED_IN_STATISTICS);
162  if (is_null($data)) {
163  return null;
164  }
165  $this->oldIncludedInStatistics = (bool) $data;
166  }
167 
169  }
170 
177  public function getNewIncludedInStatistics()
178  {
179  if (is_null($this->newIncludedInStatistics)) {
181  $data = $this->raw(self::FIELD_NEW_INCLUDED_IN_STATISTICS);
182  if (is_null($data)) {
183  return null;
184  }
185  $this->newIncludedInStatistics = (bool) $data;
186  }
187 
189  }
190 
197  public function getTarget()
198  {
199  if (is_null($this->target)) {
201  $data = $this->raw(self::FIELD_TARGET);
202  if (is_null($data)) {
203  return null;
204  }
205  $className = ReferenceModel::resolveDiscriminatorClass($data);
206  $this->target = $className::of($data);
207  }
208 
209  return $this->target;
210  }
211 
218  public function getForce()
219  {
220  if (is_null($this->force)) {
222  $data = $this->raw(self::FIELD_FORCE);
223  if (is_null($data)) {
224  return null;
225  }
226  $this->force = (bool) $data;
227  }
228 
229  return $this->force;
230  }
231 
232 
236  public function setOldState(?StateReference $oldState): void
237  {
238  $this->oldState = $oldState;
239  }
240 
244  public function setNewState(?StateReference $newState): void
245  {
246  $this->newState = $newState;
247  }
248 
253  {
254  $this->oldIncludedInStatistics = $oldIncludedInStatistics;
255  }
256 
261  {
262  $this->newIncludedInStatistics = $newIncludedInStatistics;
263  }
264 
268  public function setTarget(?Reference $target): void
269  {
270  $this->target = $target;
271  }
272 
276  public function setForce(?bool $force): void
277  {
278  $this->force = $force;
279  }
280 }
__construct(?StateReference $oldState=null, ?StateReference $newState=null, ?bool $oldIncludedInStatistics=null, ?bool $newIncludedInStatistics=null, ?Reference $target=null, ?bool $force=null, ?string $type=null)