commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ReviewDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
25 use stdClass;
26 
30 final class ReviewDraftModel extends JsonObjectModel implements ReviewDraft
31 {
36  protected $key;
37 
42  protected $uniquenessValue;
43 
48  protected $locale;
49 
54  protected $authorName;
55 
60  protected $title;
61 
66  protected $text;
67 
72  protected $target;
73 
78  protected $state;
79 
84  protected $rating;
85 
90  protected $customer;
91 
96  protected $custom;
97 
98 
102  public function __construct(
103  ?string $key = null,
104  ?string $uniquenessValue = null,
105  ?string $locale = null,
106  ?string $authorName = null,
107  ?string $title = null,
108  ?string $text = null,
109  ?JsonObject $target = null,
111  ?int $rating = null,
113  ?CustomFieldsDraft $custom = null
114  ) {
115  $this->key = $key;
116  $this->uniquenessValue = $uniquenessValue;
117  $this->locale = $locale;
118  $this->authorName = $authorName;
119  $this->title = $title;
120  $this->text = $text;
121  $this->target = $target;
122  $this->state = $state;
123  $this->rating = $rating;
124  $this->customer = $customer;
125  $this->custom = $custom;
126  }
127 
134  public function getKey()
135  {
136  if (is_null($this->key)) {
138  $data = $this->raw(self::FIELD_KEY);
139  if (is_null($data)) {
140  return null;
141  }
142  $this->key = (string) $data;
143  }
144 
145  return $this->key;
146  }
147 
155  public function getUniquenessValue()
156  {
157  if (is_null($this->uniquenessValue)) {
159  $data = $this->raw(self::FIELD_UNIQUENESS_VALUE);
160  if (is_null($data)) {
161  return null;
162  }
163  $this->uniquenessValue = (string) $data;
164  }
165 
166  return $this->uniquenessValue;
167  }
168 
175  public function getLocale()
176  {
177  if (is_null($this->locale)) {
179  $data = $this->raw(self::FIELD_LOCALE);
180  if (is_null($data)) {
181  return null;
182  }
183  $this->locale = (string) $data;
184  }
185 
186  return $this->locale;
187  }
188 
195  public function getAuthorName()
196  {
197  if (is_null($this->authorName)) {
199  $data = $this->raw(self::FIELD_AUTHOR_NAME);
200  if (is_null($data)) {
201  return null;
202  }
203  $this->authorName = (string) $data;
204  }
205 
206  return $this->authorName;
207  }
208 
215  public function getTitle()
216  {
217  if (is_null($this->title)) {
219  $data = $this->raw(self::FIELD_TITLE);
220  if (is_null($data)) {
221  return null;
222  }
223  $this->title = (string) $data;
224  }
225 
226  return $this->title;
227  }
228 
235  public function getText()
236  {
237  if (is_null($this->text)) {
239  $data = $this->raw(self::FIELD_TEXT);
240  if (is_null($data)) {
241  return null;
242  }
243  $this->text = (string) $data;
244  }
245 
246  return $this->text;
247  }
248 
255  public function getTarget()
256  {
257  if (is_null($this->target)) {
259  $data = $this->raw(self::FIELD_TARGET);
260  if (is_null($data)) {
261  return null;
262  }
263  $this->target = $data;
264  }
265 
266  return $this->target;
267  }
268 
275  public function getState()
276  {
277  if (is_null($this->state)) {
279  $data = $this->raw(self::FIELD_STATE);
280  if (is_null($data)) {
281  return null;
282  }
283 
284  $this->state = StateResourceIdentifierModel::of($data);
285  }
286 
287  return $this->state;
288  }
289 
298  public function getRating()
299  {
300  if (is_null($this->rating)) {
302  $data = $this->raw(self::FIELD_RATING);
303  if (is_null($data)) {
304  return null;
305  }
306  $this->rating = (int) $data;
307  }
308 
309  return $this->rating;
310  }
311 
318  public function getCustomer()
319  {
320  if (is_null($this->customer)) {
322  $data = $this->raw(self::FIELD_CUSTOMER);
323  if (is_null($data)) {
324  return null;
325  }
326 
327  $this->customer = CustomerResourceIdentifierModel::of($data);
328  }
329 
330  return $this->customer;
331  }
332 
339  public function getCustom()
340  {
341  if (is_null($this->custom)) {
343  $data = $this->raw(self::FIELD_CUSTOM);
344  if (is_null($data)) {
345  return null;
346  }
347 
348  $this->custom = CustomFieldsDraftModel::of($data);
349  }
350 
351  return $this->custom;
352  }
353 
360  {
362  $data = $this->raw(self::FIELD_TARGET);
363  if (is_null($data)) {
364  return null;
365  }
366 
368  }
369 
376  {
378  $data = $this->raw(self::FIELD_TARGET);
379  if (is_null($data)) {
380  return null;
381  }
382 
384  }
385 
389  public function setKey(?string $key): void
390  {
391  $this->key = $key;
392  }
393 
397  public function setUniquenessValue(?string $uniquenessValue): void
398  {
399  $this->uniquenessValue = $uniquenessValue;
400  }
401 
405  public function setLocale(?string $locale): void
406  {
407  $this->locale = $locale;
408  }
409 
413  public function setAuthorName(?string $authorName): void
414  {
415  $this->authorName = $authorName;
416  }
417 
421  public function setTitle(?string $title): void
422  {
423  $this->title = $title;
424  }
425 
429  public function setText(?string $text): void
430  {
431  $this->text = $text;
432  }
433 
437  public function setTarget(?JsonObject $target): void
438  {
439  $this->target = $target;
440  }
441 
445  public function setState(?StateResourceIdentifier $state): void
446  {
447  $this->state = $state;
448  }
449 
453  public function setRating(?int $rating): void
454  {
455  $this->rating = $rating;
456  }
457 
462  {
463  $this->customer = $customer;
464  }
465 
469  public function setCustom(?CustomFieldsDraft $custom): void
470  {
471  $this->custom = $custom;
472  }
473 }
__construct(?string $key=null, ?string $uniquenessValue=null, ?string $locale=null, ?string $authorName=null, ?string $title=null, ?string $text=null, ?JsonObject $target=null, ?StateResourceIdentifier $state=null, ?int $rating=null, ?CustomerResourceIdentifier $customer=null, ?CustomFieldsDraft $custom=null)
setCustomer(?CustomerResourceIdentifier $customer)